Connecting Tech Pros Worldwide Help | Site Map

Design Normalization

bilibytes's Avatar
Familiar Sight
 
Join Date: Jun 2008
Location: Europe
Posts: 128
#1: May 16 '09
Hi,

I don't know what is the best design practice for this example:

I have a table USERS with: id, name, ..., location_id
and a table LOCATIONS: id, name

what do you think is best:
1. store the USERS and LOCATIONS relationship in a third table called User_to_Location: user_id, location_id
or
2.leave it as it is with two tables and having the location_id in the USERS table?

in the 1. option i should make two joins for querying
in the 2. option i should make one join for querying

but maybe the second is not a good design practice ? i don't know...

Do you have any suggestion?

Thank you very much
mwasif's Avatar
Moderator
 
Join Date: Jul 2006
Location: Pakistan
Posts: 718
#2: May 16 '09

re: Design Normalization


Can a user belong to multiple locations? If not, keep the location_id in USERS table otherwise create a third table.
bilibytes's Avatar
Familiar Sight
 
Join Date: Jun 2008
Location: Europe
Posts: 128
#3: May 16 '09

re: Design Normalization


Quote:

Originally Posted by mwasif View Post

Can a user belong to multiple locations? If not, keep the location_id in USERS table otherwise create a third table.

Ok thank you very much!
Reply