pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedINSERT value of type table
2+ messages / 2 participants
[nested] [flat]
* INSERT value of type table
@ 2001-05-25 08:29 Mourad EL HADJ MIMOUNE <mimoune@ensma.fr>
0 siblings, 1 reply; 2+ messages in thread
From: Mourad EL HADJ MIMOUNE @ 2001-05-25 08:29 UTC (permalink / raw)
To: pgsql-sql
Hi,
I want know how we can insert values in the case where the type of column is
an othor table.
exemple:
CRETAE TABLE Address (Number integer, Street varchar, city varchar, contry
varchar);
CREATE TABLE Person (Name varchar, addr Address);
INSERT INTO addrerss VALUES ( 5, 'rue du pont', 'Lyon', 'France');
The question is :
How we can insert a new person whose address is that inserted in the
table of the addresses.
thank you for your help,
Mourad.
----- Original Message -----
From: <pgsql-sql-owner@postgresql.org>
To: <pgsql-sql@postgresql.org>
Sent: Friday, May 25, 2001 1:20 AM
Subject: Daily Digest V1 #393
> Daily Digest (mime) - Volume 1 : Issue 393
>
> Today's Topics:
> where's ALTER TABLE table DROP [ COLUMN ] column???
> Re: Recursive select
> Stored Procedures?
> Re: Stored Procedures?
> Recursive select
> photos and OID's
> ports in use question
> Select help
> Re: ports in use question
>
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: INSERT value of type table
@ 2001-05-30 21:31 Frank Contrepois <sokak@tin.it>
parent: Mourad EL HADJ MIMOUNE <mimoune@ensma.fr>
0 siblings, 0 replies; 2+ messages in thread
From: Frank Contrepois @ 2001-05-30 21:31 UTC (permalink / raw)
To: pgsql-sql
> exemple:
> CRETAE TABLE Address (Number integer, Street varchar, city varchar, contry
> varchar);
> CREATE TABLE Person (Name varchar, addr Address);
> INSERT INTO addrerss VALUES ( 5, 'rue du pont', 'Lyon', 'France');
> The question is :
> How we can insert a new person whose address is that inserted in the
> table of the addresses.
CREATE TABLE Address (Number integer PRIMARY KEY, Street varchar, City
varchar, Country varchar)
CREATE TABLE Person (Name varchar, addr integer REFERENCES TO Address)
this is called a FOREIGN KEY.. look at some doc for it. this is the way
Relational DB works
bye
--
--
"L'idea di base è estremamente semplice..."
©opyright Frank "Pazzooo" Contrepois (schiavista francese del '900)
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-05-30 21:31 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-25 08:29 INSERT value of type table Mourad EL HADJ MIMOUNE <mimoune@ensma.fr>
2001-05-30 21:31 ` Frank Contrepois <sokak@tin.it>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox