Search Postgresql Archives

General question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





 
Hello,
Some times the primary key is the same as the foreign key such as in the following design. which is used to model 1-1 relationship.
In the database books, such as database fundamentals(Masri), the 1-1 relation is modeled by having two separate key. 
when this kind of design (shared key) is preferable and  is there any anomalies to it.
 

create table Table1
( T1_Id    integer     not null primary key
, T1_Data  varchar(9)  not null
)
create table Table2
( T2_Id    integer     not null primary key
, T2_Data  varchar(37) not null
, foreign key (T2_Id) references Table1 (T1_Id)
)
 

Thanks in advance


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux