Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 One To One Relationship Tables

Author  Topic 

SouthSideRob
Starting Member

22 Posts

Posted - 2008-08-04 : 11:20:39
I have two tables where I only want one record to show up for each account.

In table a, I have an ID field which is the primary key (Identity Field)
In table b, I have an ID field which is the primary key
In Table B, I created a foreign key constraint with table a relating
the two ID fields.

If this the correct way to setup a one-to-one relationship in a database?

I know that I should know but it's been awhile and you guys are pro's.
Thanks...

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2008-08-05 : 08:47:52
For one-to-one you'll need a unique constraint on the FK in B. Alternatively put it all of B in A if that's a sensible option.
Go to Top of Page
   

- Advertisement -