July 29, 2008 at 12:48 pm
Hi all,
I have a main user table which stores basic information for which UserID is the primary key. I have another table, UserExtended which stores more detailed information about the user which i dont want to store in the user table. In this scenario, Can I have the UserID in the UserExtended as primary key and foreign key referencing the main User table or can i have a identity column as a primary key and have the UserID as a foreign key.
I wanted to know can we have the same column as primary key and foreign key?
Any suggestions is greatly appreciated.
Thank you very much guys. This forum is awesome.
July 29, 2008 at 1:28 pm
Yes, you absolutely can. It's a pretty common design method. The one place almost everyone will agree that something like this applies is in a many-to-many relationship. There are other places, such as what you outline, that will support it as well.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
July 29, 2008 at 2:04 pm
Yeah, I do exactly that in what I call extended properties tables. PK and FK the same column.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 29, 2008 at 4:19 pm
ThankYou Guys, I really appreciate that
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply