Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f55JPgE59242 for ; Tue, 5 Jun 2001 15:25:42 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4ULwDE94113 for ; Wed, 30 May 2001 17:58:13 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f4ULYE858781 for pgsql-sql@postgresql.org; Wed, 30 May 2001 17:34:14 -0400 (EDT) (envelope-from news) From: "Frank Contrepois" X-Newsgroups: comp.databases.postgresql.sql Subject: Re: INSERT value of type table Date: Wed, 30 May 2001 23:31:54 +0200 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 24 Message-ID: <9f3p0l$1pcq$1@news.tht.net> References: <002501c0e4f4$d053cd40$71a337c1@ensma.fr> X-Complaints-To: scrappy@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 To: pgsql-sql@postgresql.org X-Archive-Number: 200106/41 X-Sequence-Number: 3244 > 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)