Re: Creating related tables - Mailing list pgsql-novice

From A. Kretschmer
Subject Re: Creating related tables
Date
Msg-id 20051019130649.GA12829@webserv.wug-glas.de
Whole thread Raw
In response to Creating related tables  (Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br>)
List 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    ===

pgsql-novice by date:

Previous
From: "Kevin Crenshaw"
Date:
Subject: Re: Creating related tables
Next
From: "Cristian Prieto"
Date:
Subject: SQL return value...