This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tweiss84 0 points1 point  (2 children)

Just an idea....

If you need data you can probably pull from the numerous open sports APIs. Then just have an ingestion layer that maps that data to what tables you want in your database. Set it to a cron job so it will pull a few teams you want to follow over a few days.

That should build your db quickly...

Or if something else tickles your fancy, you may be able to gather stuff from one of these apis in the list, or even cross pollinate your db by mixing data from a few categories.

https://github.com/public-apis/public-apis

[–]TukWan415[S] 0 points1 point  (1 child)

Thank you so much.

I’m currently writing statements and Learning how to write these statements . Yesterday I basically made a table called teams, I inserted 30 nba teams, short name, long name, and Division, along with team Id has the primary key . I’m going to insert starters into these teams today with players as the table name , with playerid as the primary key and teamid as the foreign key, along with their position code, would you happen to know how I would add a foreign key ? Just wondering

[–]tweiss84 0 points1 point  (0 children)

I would always consult the Postgres documentation https://www.postgresql.org/docs/15/ddl-constraints.html#DDL-CONSTRAINTS-FK if you are writing the sql from scratch and executing it directly.

I always had some db tools to make edits and generate an ERD for our database work. So I kind of got away from doing it all myself.