Jump to content

Linking tables


mds1256

Recommended Posts

Hi

 

Just working on a bit database design and have the following scenario:

 

 

users Table = Contains ID, username and password

 

personDetails Table = contains ID, userid, first name, surname, DoB

 

 

Now when linking the table e.g. to return First and Surname for a specific username is it better to have a linking table as well, so for example (pseudo speak)

 

Select firstname, surname from personDetails, users where personDetails.userid = users.id

 

Or have another linking table and that to contain:

 

id

userID

personDetailsID

 

and use this to link, or does it not matter which way you link?

 

 

Link to comment
https://forums.phpfreaks.com/topic/217731-linking-tables/
Share on other sites

There's no real need to have them in a separate table since there is a one to one relation, and the fields will *always* be filled. If some users didn't have a first name, surname, & DoB then it'd be much better to create that second table.

 

I'm not saying it's wrong and won't work the way you have it, though :)

Link to comment
https://forums.phpfreaks.com/topic/217731-linking-tables/#findComment-1130224
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.