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
 New to SQL Server Programming
 One to One Relationship

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2009-08-09 : 21:15:35
Hello,

I have three tables:

User, Profile and Professor.

User contains membership information on the user like username, password, lastlogin, etc.

Profile contains personal information on the user like name, birthday, city, district, etc.

Professor contains information on the User in case of a Professor. If the user is not a Professor then it will be empty.

I think I should create a One to One relationship between the three tables on the following order:

User > Profile > Professor

Does this make any sense?

And how should I create this?

Thanks,
Miguel

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-08-09 : 23:42:28
sounds like every user should have a record in profile. professor should have userID as a FK to user.
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-08-10 : 00:26:37
i think is this enough for table structure

user table -> userid identity(1,1) primarykey, username, password, lastlogin
profiletable -> profileid identity(1,1) primarykey,userid foreign key , name, birthday, city, district

professor table-> professorid identity(1,1) primarkey,userid foreign key allow null,remaining columns
Go to Top of Page
   

- Advertisement -