Jump to content

Normalised Efficient Database


mattyvx

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

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.