I am trying to create a script to create a table with has the following attributes 'medal_events(day, sport#*, gold_win*, silver_win*, bronze_win*)'
Anything with '#' is a primary Key, and anything with '*' is a foreign key. Now there are three foreign keys which need to reference the same data column in a table named 'athletes', and it is the PK of that table which is being referenced.
The error I'm getting I have spooled and outputted below:
SQL> @create_medal_events REFERENCES athletes (ath_code)) * ERROR at line 11: ORA-02256: number of referencing columns must match referenced columns SQL> spool off
And the actual script that I have written which creates this error every time I try to run it is as follows:
CREATE TABLE medal_events (day DATE, sport VARCHAR2(7) NOT NULL, gold_win VARCHAR2(7), silver_win VARCHAR2(7), bronze_win VARCHAR2(7), CONSTRAINT pk_medal_events PRIMARY KEY (sport), CONSTRAINT fk_sports FOREIGN KEY (sport) REFERENCES sports (spo_code), CONSTRAINT fk_athletes FOREIGN KEY (gold_win, silver_win, bronze_win) REFERENCES athletes (ath_code));
Some help with this would be most appreciated!