Try:
CREATE TABLE owners (
Ownerid SERIAL PRIMARY KEY,
Ownername TEXT
);
CREATE TABLE motorcycles(
Mid SERIAL PRIMARY KEY,
Mname TEXT,
Ownerid INTEGER REFERENCES owners(ownerid)
ON DELETE CASCADE
);
HTH,
Kevin
-----Original Message-----
From: pgsql-novice-owner@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Ângelo Marcos Rigo
Sent: Wednesday, October 19, 2005 8:34 AM
To: pgsql-novice@postgresql.org
Subject: [NOVICE] Creating related tables
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 ?
Ângelo Marcos Rigo
AMR Informática
(51) 3348 0870
Rua Pe. Alois Kades 400/210
Porto Alegre /RS/Brasil
http://amr.freezope.org
angelo_rigo@yahoo.com.br
_______________________________________________________
Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e
concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster