Skip site navigation (1) Skip section navigation (2)

Re: Creating related tables

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: (view raw or whole 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);
test=> create table a (id int references b on delete cascade);

Regards, Andreas
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47212,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C
 ===    Schollglas Unternehmensgruppe    === 

In response to

pgsql-novice by date

Next:From: Michael GlaesemannDate: 2005-10-19 13:09:53
Subject: Re: Creating related tables
Previous:From: Ângelo Marcos RigoDate: 2005-10-19 12:34:20
Subject: Creating related tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group