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