Re: INSERT value of type table

Поиск
Список
Период
Сортировка
От Frank Contrepois
Тема Re: INSERT value of type table
Дата
Msg-id 9f3p0l$1pcq$1@news.tht.net
обсуждение исходный текст
Ответ на INSERT value of type table  ("Mourad EL HADJ MIMOUNE" <mimoune@ensma.fr>)
Список 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)





В списке pgsql-sql по дате отправления:

Предыдущее
От: Hans-Jürgen Schönig
Дата:
Сообщение: Re: How to use the template table in postgresql
Следующее
От: "Frank Contrepois"
Дата:
Сообщение: Re: Is it possible to defer triggers?