Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Posts
    16

    Unanswered: 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.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •