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

Home -> Community -> Usenet -> comp.databases.theory -> Re: Simple linking table question

Re: Simple linking table question

From: Tony <andrewst_at_onetel.net.uk>
Date: 20 Mar 2003 12:40:00 -0800
Message-ID: <c0e3f26e.0303201240.5dd09d07@posting.google.com>


"Jon Maz" <jonmaz_at_surfeu.de.no.spam> wrote in message news:<b5ae5m$hev$1_at_news.online.de>...
> My "weird-looking" linking table to join the above two - can this possibly
> be correct???:
>
> CREATE TABLE tblPeople_Events_Notes (
> EventID [int] NOT NULL PRIMARY KEY CLUSTERED,
> PersonID [int] NOT NULL PRIMARY KEY CLUSTERED,
> NoteID [int] NOT NULL PRIMARY KEY CLUSTERED,
> CONSTRAINT FOREIGN KEY EventID REFERENCES tblEvents[EventID]
> CONSTRAINT FOREIGN KEY PersonID REFERENCES tblPeople[PersonID]
> CONSTRAINT FOREIGN KEY NoteID REFERENCES tblNotes[NoteID]

Not quite, if it is to link tblPeople_Events to tblNotes. The FK constraints should be:

CONSTRAINT FOREIGN KEY (EventID,PersonID) REFERENCES tblPeople_Events(EventID,PersonID)
CONSTRAINT FOREIGN KEY NoteID REFERENCES tblNotes(NoteID) Received on Thu Mar 20 2003 - 14:40:00 CST

Original text of this message

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