Hello!
I am currently working through the Relational Database Course – World Cup Database using the desktop version of Visual Studio Code.
I have a question about a possible misspelling in this instruction:
Your
games
table should havewinner_id
andopponenent_id
foreign key columns that each referenceteam_id
from theteams
table
The word opponenent seems to be misspelled. Is this intentional? In other areas of the written instructions it is spelled correctly: “opponent”.
The second issue that I appear to be having is that after I have created my teams table per the instructions I am getting green checks.
Here is the sql commands to view the table as I have it created at present:
\d games
Table "public.games"
Column | Type | Collation | Nullable | Default
game_id | integer | | not null | nextval('games_game_id_seq'::regclass)
year | integer | | not null |
round | character varying | | not null |
winner_goals | integer | | not null |
opponent_goals | integer | | not null |
winner_id | integer | | |
opponenent_id | integer | | |
Indexes: "games_pkey" PRIMARY KEY, btree (game_id)
Foreign-key constraints: "games_opponenent_id_fkey" FOREIGN KEY (opponenent_id) REFERENCES teams(team_id)
"games_winner_id_fkey" FOREIGN KEY (winner_id) REFERENCES teams(team_id)
When I run the checks it is giving me this error:
SUBTASKS 1.1 :5 Your “games” table should have correct “winner_id” and “opponent_id” foreign key columns
I am thinking that the misspelling is the problem. As you can see from my SQL I did as instructed, creating a foreign key called “opponenent_id” but I think I should have not named it that. Instead used the correct spelling opponent_id.
Any help would or insight would be greatly appreciated.
Thank you,
Richard