Jump to content

Recommended Posts

Hi,

 

I was wondering if you could shed some light on something for me;

 

I want to know what the most efficient database structure would be for the following.

 

I have a member table,

-----------------------------

ID | Company  | Price |  About

 

a Cities table

----------------------------

CityID  |  City

 

and a Member_to_Cities table.

ID  |  CityID

 

My site currently works by showing member details for a specfic City. Now my site has grown I want to add an "Areas" table into the mixer.

 

So users can select memebers from a City or an Area of a city.

 

One member can be registered to many Cities.

One member can be registered to many Areas.

One city can have many Areas.

 

How would you guys go about this? Should I add two more tables...?

 

Areas

-------------

AreaID  |  CityID  | Area

 

Members_to_Areas

------------------------

AreaID  |  ID

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/188233-normalised-efficient-database/
Share on other sites

Yeah however I would remove Member_to_Cities as Member_to_Areas allows you to retrieve the city. If you are unsure on your db structure you can always draw a ERD to verify all relations are correct or needs adjusting.

 

http://en.wikipedia.org/wiki/Entity-relationship_model

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.