[SQL] two tables - foreign keys referring to each other...]

2001-02-21 Thread Josh Berkus
Chris, > ..or generally: how do you create two crosslinked foreign keyed tables? > > hopefully an easy problem for the real professionals! No. The problem is: Why would you want to create two crosslinked foriegn-keyed tables? As an experienced SQL professional, this seems like a reci

Re: [SQL] two tables - foreign keys referring to each other...

2001-02-21 Thread Grigoriy G. Vovk
I think, if it is relationship many-to-many (one admin can be in many institute, and one institute can has many admin, you should use relation table, see below. > -> here we go > BEGIN; -- begin table transaction -- Only Postgresql > CREATE TABLE institute_t ( > name

Re: [SQL] two tables - foreign keys referring to each other...

2001-02-21 Thread Frank Joerdens
On Tue, Feb 20, 2001 at 11:34:30PM -0800, Stephan Szabo wrote: > > You have to use ALTER TABLE to add the constraint to one of the tables. Maybe I am stating the obvious but you should make sure that you include the ALTER TABLE statements in the *.sql files that you use to create the tables, rat

[GENERAL] Re: [SQL] two tables - foreign keys referring to each other...

2001-02-20 Thread Stephan Szabo
You have to use ALTER TABLE to add the constraint to one of the tables. Deferred refers to the checking of the constraint itself, not really to the check to see if the table is there. On Wed, 21 Feb 2001, Chris Czeyka wrote: > Hey to all, > > I got two tables, linked to each other. How can I t

Re: [SQL] two tables - foreign keys referring to each other...

2001-02-20 Thread Chris Czeyka
ThX Kirby, ThX Martijn, as you can see I'm new to the SQL- and database world. My policy for this project is to FORCE an admin to be in an institute. If one admin behaves bad for the database project the institute is responsible for her/him. This institute would be represented by a special admin

[SQL] two tables - foreign keys referring to each other...

2001-02-20 Thread Chris Czeyka
Hey to all, I got two tables, linked to each other. How can I tell the first CREATE TABLE (institute_t) to wait to check the foreign key for the second table??? just like "hold on a little bit... you'll receive your admin_t" :-) ? I thoght DEFERRABLE, DEFERRED and transaction with BEGIN/COMMIT ta