How can I create a table which accepts a foreign key but may have multiple values for the same row?
17:25 14 Feb 2012

How can I create a table which accepts a foreign key but may have multiple values for the same row?

For example:

Employee (id, name, skillid);
Skill (skillid, skillname);

An instance for Employee could be

Employee(311, "john", (01, 02) );
Skill(01, Java); Skill (02, C++);

I made (is, skillid) primary key.

But:

create table Movie (
    Movie_ID varchar(5),                        
    Cast varchar(5),
    foreign key(Cast) references Person(Person_ID),
    primary key(movie_id, Cast));

create table Awards (
    Award_Id varchar(5),
    Person_Id varchar(5), 
    Movie_Id varchar(5),
    Award_Name  varchar(30),
    Year number(4),
    Organization_Id varchar(5),

    primary key (Award_id,year,Organization_Id),
    foreign key(Person_Id) references Person(Person_ID),
    -- foreign key(Movie_ID) references Movie(Movie_ID),
    foreign key(Organization_Id) references Organization(Organization_Id));

I am not able to use Movie_ID as a Foreign key since the table it is referencing has combination of two things as its primary key and I am not using second of those attribute in the Awards table.

database oracle-database