Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Foreign key in Oracle Sql

Foreign key in Oracle Sql

From: Silver <argytzak_at_med.auth.gr>
Date: Thu, 6 Jan 2005 18:27:12 +0300
Message-ID: <crjom5$5rm$1@nic.grnet.gr>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US