Обсуждение: Foreign Key in PostGreSQL

Поиск
Список
Период
Сортировка

Foreign Key in PostGreSQL

От
Filipi Damasceno Viana
Дата:
I am a universitary student from BRASIL, and I�m using PostGreSQL data base.
I�m designing my data base and I have one question.
How to create a foreing key in PostGreSQL.
I�m using the following command:
CREATE TABLE test(
pnr char(10),
nome char(20),
id   decimal REFERENCE <parent table>);

and

CREATE TABLE test(
pnr char(10),
nome char(20),
id decimal,
FOREING KEY (id) REFERENCES <parent table>);

Where parent table is the table with the primary key.

Regards

Filipi Damasceno Vianna
&
Alessandro Orso