[pgsql-ayuda] Foreign key

=?iso-8859-1?Q?Jos=E9?= Soares sferac@bo.nettuno.it
Mon, 29 Mar 1999 14:30:52 +0200


cesar ha scritto:

> Hola,
> puede SQL definir foreign keys en una table ?
>

-- Claro que si.

>
> Como ??

--Asi:

> FOREIGN KEY <Table Constraint> definition ::=
>      [ CONSTRAINT <Constraint name> ]
>      FOREIGN KEY (referencing <Column name> [,<Column name>...])
>           REFERENCES referenced <Table name>
>                [ (referenced <Column name> [,<Column name>...]) ]
>           [ MATCH {FULL | PARTIAL} ]
>           [ ON UPDATE <action> ]
>           [ ON DELETE <action> ]
>           [ ON UPDATE <action> ]
>      [ <Constraint attributes> ]
>
>                <action> ::=
>                     NO ACTION |
>                     CASCADE |
>                     SET NULL |
>                     SET DEFAULT

> FOREIGN KEY <Column Constraint> definition ::=
>  [ CONSTRAINT <Constraint name> ]
>  REFERENCES referenced <Table name>
>  [ (referenced <Column name> [,<Column name>...]) ]
>  [ MATCH {FULL | PARTIAL} ]
>  [ ON UPDATE <action> ]
>  [ ON DELETE <action> ]
>  [ ON UPDATE <action> ]
>  [ <Constraint attributes> ]
>
>
> Ejemplo:

> -- CREATE TABLE table2 (
>      column1 SMALLINT,
>      CONSTRAINT constraint1
>           FOREIGN KEY(column1) REFERENCES table1);
>

La Foreign Key todavia no esta implementada en PostgreSQL, el reconoce
solamente parte de la sintax.

>
>
> Gracias
>

De nada.
Jose'

--------- Pie de mensaje -------------------------------------------
Archivo historico: http://tlali.iztacala.unam.mx/maillist/pgsql-ayuda
Cancelar inscripcion:
mail to: majordomo@tlali.iztacala.unam.mx
text   : cancelacion pgsql-ayuda