If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > DB Design Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-20-09, 18:54
socca socca is offline
Registered User
 
Join Date: Jan 2009
Posts: 16
DB Design Question

I am trying to design a database that will hold a customers information plus also have a listing of the services they provide, which is search friendly so it wont lag. The customer would pick from a static list, check boxes, of what services they provide, which would inturn populate the table. I just cant seem to figure out how to design this efficiently. The search would be similar also someone would go to the search page and just pick which services they are looking for. Any help would be greatly appreciated.
Reply With Quote
  #2 (permalink)  
Old 01-20-09, 22:46
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
one table for customers, primary key: cust_id

one table for services, primary key: serv_id

one table for customerservices: primary key: (cust_id,serv_id)

so in the third table, there will be one row for each service provided for each customer

this is the classic many-to-many design
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-21-09, 08:26
socca socca is offline
Registered User
 
Join Date: Jan 2009
Posts: 16
Brain Fart

Thank you very much, i was trying to do that in my head but just wasnt working out.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On