Welcome Guest, Not a member yet? Register   Sign In
MySQL database structure - one-to-many-many
#6

[eluser]alexmiller[/eluser]
Guys, thanks for all your help - this makes sense and I'm going to summarise what I intend to do here for anyone who searches this topic. I am going to go with the route whereby I have a single table for telephones and a single one for addresses. I will then have the following fields in my tables:
Code:
telephone
---------
owner_id  -> the ID number of the entry with this number (it might be a business, a user, or a customer)
owner_table -> name of the table for this owner ('businesses','users' etc)
telephone_number
telephone_type -> ('landline','fax','mobile')
rank -> tinyint allowing me to customise the order in which telephone numbers are displayed
The structure for the address column will be virtually the same.

This allows me to attach telephone numbers and addresses to any objects (businesses, users, contacts, customers, advertisers etc) in my database. Managing telephone numbers will be easy, and can be handled using a single model which might also deal with formatting for display (domestic without +, international including + and country code).


Messages In This Thread
MySQL database structure - one-to-many-many - by El Forum - 04-20-2009, 05:38 PM
MySQL database structure - one-to-many-many - by El Forum - 04-20-2009, 06:21 PM
MySQL database structure - one-to-many-many - by El Forum - 04-21-2009, 02:31 AM
MySQL database structure - one-to-many-many - by El Forum - 04-21-2009, 03:32 AM
MySQL database structure - one-to-many-many - by El Forum - 04-21-2009, 03:40 AM
MySQL database structure - one-to-many-many - by El Forum - 04-21-2009, 08:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB