Re: Forein Key
| От | Frank Joerdens |
|---|---|
| Тема | Re: Forein Key |
| Дата | |
| Msg-id | 20010309185352.A22425@rakete.joerdens.de обсуждение исходный текст |
| Ответ на | Forein Key ("Marcelo Pereira" <gandalf@sum.desktop.com.br>) |
| Список | pgsql-general |
On Fri, Mar 09, 2001 at 03:43:55PM -0300, Marcelo Pereira wrote:
>
> Hi,
>
>
>
> I'm a new user and I would like to know if I can create my table using
> forein key's.
Sure. Here's an example:
test=> CREATE TABLE statename ( code CHAR(2) PRIMARY KEY,
test(> name CHAR(30)
test(> );
CREATE
test=> INSERT INTO statename VALUES ('AL', 'Alabama');
INSERT 18934 1
test=> CREATE TABLE customer (
test(> customer_id INTEGER,
test(> name CHAR(30),
test(> telephone CHAR(20),
test(> street CHAR(40),
test(> city CHAR(25),
test(> state CHAR(2) REFERENCES statename,
test(> zipcode CHAR(10),
test(> country CHAR(20)
test(> );
CREATE
(from Bruce Momjian's excellent book on PostgreSQL)
Regards, Frank
В списке pgsql-general по дате отправления: