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

[eluser]alexmiller[/eluser]
Hi all

I am at the planning stage of a project and want to get my head around the way to structure a specific part of the database.

The database will store a number of tables, but for the purpose of this question I'll simplify it down. I want a table called businesses and a table called users. Both users and businessess can have multiple telephone numbers (eg. mobile, landline, fax). I want to store the telephone numbers in a separate table to prevent repitition, and to allow multiple numbers for each business.

So, here is my problem. Should I create the telephones table as follows:

Code:
owner_id : the ID of the owner (eg. business_id or user_id)
owner_table : the name of the owners table (eg. businesses or users)
telephone_number : obvious really
telephone_type : eg. fax, landline etc.

This seems to make sense to me, but can anyone see a problem with this? Can anyone suggest what this might be called so that I can have a read up on Google. I also want to use the same structure for addresses.

Kind regards

Alex


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