From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Creating related tables |
Date: | 2005-10-19 13:06:49 |
Message-ID: | 20051019130649.GA12829@webserv.wug-glas.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
am 19.10.2005, um 12:34:20 +0000 mailte Ângelo Marcos Rigo folgendes:
> Hi
>
> I need to create 1:N related tables .
>
> eg.: table A and a table B.
> - table B will have motorcicles
> - table A will have motorcicles owners
> If a owner is deleted from the table A i need to
> delete all the motorcicles with the deleted owner id
> in the B table.
>
> What is the sintax in postgesql todo this ?
test=> create table b (id int primary key);
CREATE TABLE
test=> create table a (id int references b on delete cascade);
CREATE TABLE
test=>
Regards, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Glaesemann | 2005-10-19 13:09:53 | Re: Creating related tables |
Previous Message | Ângelo Marcos Rigo | 2005-10-19 12:34:20 | Creating related tables |