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
Share on other sites

There's no need for a third relational table. Unless a user has many personDetails... which probably doesn't make much sense.

 

Also, if every user has a userid, firstname, surname, DoB, username, and password, then I'd put them into one table.

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.