create table t2
( c1t1 integer,
  c2t2 integer,
  c3t2 integer,
primary key (c1t1, c2t2),
foreign key (c1t1) references t1 (c1t1),
*unique (c2t2)); **n necessita dessa linha visto que primary key ja sao
unique e not null por padrão*

*De resto está correto.*

2017-11-24 15:46 GMT-03:00 Márcio A. Sepp <mar...@zyontecnologia.com.br>:

>
>
> Boa tarde,
>
>
> Por favor, está correta esta definição ou estou fazendo algo que não
> deveria
> ser feito pelo campo justamente ser chave?
>
> create table t1
> ( c1t1  integer,
>   c2t1  integer,
> primary key (c1t1));
>
>
> create table t2
> ( c1t1 integer,
>   c2t2 integer,
>   c3t2 integer,
> primary key (c1t1, c2t2),
> foreign key (c1t1) references t1 (c1t1),
> unique (c2t2));
>
>
>
> Att.
> Márcio A. Sepp
>
> _______________________________________________
> pgbr-geral mailing list
> pgbr-geral@listas.postgresql.org.br
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral




-- 
*Tiago Menezes Brasil*

*Oracle Database 12c - Administrator Certified Associate*
*Bacharel em Ciências da Computação* (*BCC*) - CESUPA
*Linkedin: http://www.linkedin.com/in/dbatiagomnzs
<http://www.linkedin.com/in/dbatiagomnzs>*
--* Belém - PA - Brasil* --
_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a