Results 1 to 4 of 4

Thread: Table Setup

  1. #1
    Join Date
    Apr 2010

    Question Table Setup

    Hello Everyone,

    I'm new to the forum and am happy to have found a forum dedicated to databases.

    I'm working on a little project for my construction business.

    I have an online inquiry form which potential clients fill out with their contact information aswell as the services they are interested about. Depending on the type of client(homeowner or contractor), JavaScript returns a group of checkboxes. I'm using checkboxes so clients can choose as many services as they want.

    The problem is how do I store this information into a database efficiently. without reduntant information?

    I plan to use this information to retrieve the following out of the table... How many inquiries did we get for "x" service last month? What services did the "xclient" inquiry about?

    So far i have the basic table layout for the contact information and some other stuff but again i'm not sure to input that type of data.

    Your help is appreciated.


  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    you'll want one table for your clients, one table for your services, and then a third table, corresponding to each client's submitted checkboxes, which relate a client to a service -- one row for each checkbox that the client selected

    this third table really needs only two columns, the clientid and the serviceid | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Apr 2010

    Thank you for the quick response.

    Looking back, I almost feel stupid for asking that. The solution couldn't have been anymore obvious.

    Thank you Rudy

  4. #4
    Join Date
    Jun 2003
    Isaac Newton and Archimedes felt the same way. You are in good company.
    If it's not practically useful, then it's practically useless.

    blindman "sqlblindman"

Tags for this Thread

Posting Permissions

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