var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Relate to multiple entries in a different table
Hello dbforums.com users!
I've been trying to help myself but I can't seem to find a way to implement what I want to do so I decide to post here.
I'm looking to create a DB of service providers and their info, be able to search based by location, and type of service, as well as your basic alphabetical db dump to a chart.
To be able to list the locations and service types individually it seems the best way is to have their own table.
Example of what I'm looking to do
Problem is - there doesn't seem to be a way to have multiple values like I want to do in the first table.
TABLE - PROVIDERS
Key - Name - Phone - NET - TV - Location
1 - Bell - 1 - 1 - 1/3 - 1/2/3
2 - Rogers- 2 - 2 - 2 - 1
3 - Acanac- 2 - 1/2 - 3 - 2/3
TABLE - Phone
Key - Type
1 - POTS (plain ol tele)
2 - VOIP
TABLE - NET
Key - Type
1 - DSL
2 - Cable
TABLE - TV
1 - Satellite
2 - Cable
3 - IPTV
TABLE - LOCATION
1 - Ponyville
2 - Apple Acres
3 - Equestria
Soooo I'm wondering if anyone has any suggestions as to how to design this db.
Any help is greatly appreciated.
Last edited by TheOddPerson; 02-13-13 at
add four intersection tables:
Intersection tables are used to create many-many relationship between two tables. Table:Provider_Phone ProviderID is Foreign Key to Provider(Key) PhoneID is Foreign Key to Phone(Key) Primary key is ProviderID, PhoneID Table:Provider_Net ProviderID is Foreign Key to Provider(Key) NetID is Foreign Key to Net(Key) Primary key is ProviderID, NetID Table:Provider_TV ProviderID is Foreign Key to Provider(Key) TVID is Foreign Key to TV(Key) Primary key is ProviderID, TVID Provider_Location ProviderID is Foreign Key to Provider(Key) LocationID is Foreign Key to Location(Key) Primary key on ProviderID, LocationID
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert
Thank you very much for your help!
It did take me a little bit to get the concept of many-many and how a junction table should look but I completely understand now.
I can now get straight to work on my db!
Thank you, thank you thank you!