| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Foreign key in Oracle Sql
Hi everybody and happy new year,
I was wondering this:
suppose we have 3 tables called 'rental', 'tape' and 'user'. The table
rental contains 3 columns, 'userID', 'tapeID' and 'date'. Now, all those 3
columns make up the primary key of the table 'rental'. How do I define this
table in sql ?
Do I have to include the constraint PRIMARY KEY as well as the constraint
REFERENCES , iike this:
CREATE TABLE Rental (
userID number(4) constraint fk_userid references USER(userID), tapeID number(4) constaint fk_tapeid referenes TAPE(tapeID), dateOfRental date,
constraint pk_rental (userID, tapeID, dateOfRental)
Thanks! Received on Thu Jan 06 2005 - 09:27:12 CST
![]() |
![]() |