Re: Adding a Foreign Key

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Adding a Foreign Key
Дата
Msg-id 018e01c1349c$ebbf9b70$0705a8c0@jecw2k1
обсуждение исходный текст
Ответ на Adding a Foreign Key  (tankgirl@worldonline.es)
Список pgsql-general
> Hello everyone,
>
>   I know that a Primary Key can be added to a table before it has been
created, doing this...
>
> CREATE UNIQUE INDEX table_pkey ON table (atribute);
>
>   Well I wonder if a Foreign Key can also be added and what syntax does it
follow.
>
>   Thankyou in advance.
>
>   Stay Safe & Happy.
>
>    :* TankGirl

See:

http://www.postgresql.org/idocs/index.php?sql-altertable.html

The part you're interested in says:

To add a foreign key constraint to a table:
ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address)
REFERENCES addresses(address) MATCH FULL

Hope this helps,

-- Joe





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

Предыдущее
От: Stephan Bergmann
Дата:
Сообщение: SHOW
Следующее
От: bpalmer
Дата:
Сообщение: Re: SHOW