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.
Author |
Topic |
DJBruteForce
Starting Member
1 Post |
Posted - 2008-12-10 : 01:18:31
|
Hi thereI have 3 DB tables; Member, Visitor and Downloads. Both members and visitors can have many downloads but if a visitor does a download and is not a member, there will not be a link between the member > download table. How would I design the primary and foreign keys for this scenario? Here an example of the structure I have.Member-MemberID-MemberNameVisitor-VisitorID-VisitorIPDownloads-DownloadID-MemberID-VisitorIDThanx,DJ |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-10 : 10:27:18
|
quote: Originally posted by DJBruteForce Hi thereI have 3 DB tables; Member, Visitor and Downloads. Both members and visitors can have many downloads but if a visitor does a download and is not a member, there will not be a link between the member > download table. How would I design the primary and foreign keys for this scenario? Here an example of the structure I have.Member-MemberID PK-MemberNameVisitor-VisitorID PK-VisitorIPDownloads-DownloadID PK-MemberID FK-VisitorID FKThanx,DJ
|
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-10 : 11:13:59
|
Also it would be better to make PKs as identity columns |
|
|
|
|
|