Re: [SQL] primary + foreign key

2002-12-12 Thread Bret Hughes
On Thu, 2002-12-12 at 10:27, Roberto Mello wrote: > > Read "An Introduction to Database Systems" by C.J. Date. > Boy that brings back memories. I think I will dig it out of a box since I am doing database coding again after a long hiatus. Seems like I had a couple of Date books on my shelf at

Re: [SQL] primary + foreign key

2002-12-12 Thread Roberto Mello
On Thu, Dec 12, 2002 at 10:54:21AM +0100, Huub wrote: > Thanks for pointing out. I'm not that experienced in SQL yet; so detail > could as well be some extra instruction and I've never seen 'references > master' before. But I think I'll manage now. Thanks Read "An Introduction to Database System

Re: [SQL] primary + foreign key

2002-12-12 Thread Huub
Thanks for pointing out. I'm not that experienced in SQL yet; so detail could as well be some extra instruction and I've never seen 'references master' before. But I think I'll manage now. Thanks Tomasz Myrta wrote: Huub wrote: Hi, I suppose 'detail' is the table name? And what is master? T

Re: [SQL] primary + foreign key

2002-12-12 Thread Tomasz Myrta
Huub wrote: Hi, I suppose 'detail' is the table name? And what is master? Thanks Huub You should know that. Detail is a table you want to create and master is a table where foreign key points to. Tomasz Myrta ---(end of broadcast)--- TIP 4:

Re: [SQL] primary + foreign key

2002-12-12 Thread Huub
Hi, I suppose 'detail' is the table name? And what is master? Thanks Huub create table detail ( id1 integer, id2 integer, CONSTRAINT c1 PRIMARY KEY(id1,id2), CONSTRAINT c2 FOREIGN KEY(id1,id2) REFERENCES master ); Do you really need such detail table? You can just add columns to ma

Re: [SQL] primary + foreign key

2002-12-12 Thread Tomasz Myrta
Huub wrote: Hi, I want to create a table where the 2 columns are both primary as well as foreign key. What is the correct syntax for that? Thanks Huub create table detail ( id1 integer, id2 integer, CONSTRAINT c1 PRIMARY KEY(id1,id2), CONSTRAINT c2 FOREIGN KEY(id1,id2) REFERENCES mas

[SQL] primary + foreign key

2002-12-12 Thread Huub
Hi, I want to create a table where the 2 columns are both primary as well as foreign key. What is the correct syntax for that? Thanks Huub ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-no