I have a table 'FinishedTrack' whose primary key is composite, (it consists of the attributes 'originates_from' and 'version'), I want to create another table which includes this as a foreign key.
How do I do this in a create table statement?
I have tried the following:
CREATE TABLE GroupedOn(
sequence NUMBER(38) not null,
CONSTRAINT go_id_pk PRIMARY KEY(originates_from, version, album_ID),
CONSTRAINT go_id_fk FOREIGN KEY (originates_from) REFERENCES MasterTrack(track_ID),
CONSTRAINT go_id_fk FOREIGN KEY (version) REFERENCES FinishedTrack(version),
CONSTRAINT go_id_fk FOREIGN KEY (album_ID) REFERENCES Album(album_ID));
but get this error:
ERROR at line 7:
ORA-02270: no matching unique or primary key for this column-list
I guess this is because 'version' is not a candidate key, is it possible to add the whole composite primary key (from finished track) as a foreign key? If so how do I do it?
I can provide more information if neccessary...