General question

From: salah jubeh <s_jubeh(at)yahoo(dot)com>
To: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: General question
Date: 2011-03-23 12:18:12
Message-ID: 592812.2119.qm@web52701.mail.re2.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martín Marqués 2011-03-23 12:33:00 pg_dump problems
Previous Message Vibhor Kumar 2011-03-23 10:51:56 Re: Backups with continuous archiving