design database table for survey form


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: design database table for survey form

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Posts
    1

    Question design database table for survey form

    I have to design a database table for survey form which has 10 Q and corresponding answers (as radio button options + comment text)

    keeping into mind the no of times code would need db connection for insert time and retrieval time, i have 2 options.
    HI,

    This is a very common practice but I am looking for a robust and tested solution for designing db table for a survey form which has 10 Q , 4 radio buttons each for an answer and one text area for comment.

    i have 2 options (i think..)

    1) i create a table of 30 columns; 10 for Q, 10 for A, 10 for comment text but this will take too much of code rewriting . This is good for one time db connection required for insert data.

    2) i create a transaction table of 3 columns; 1 for Qid, 1 for Ans, 1 for Anstext.
    another master table to store Qid, Qtext. where Qid acts as forign key in transaction table. This requires less coding (speaking in terms of prepare statement in java) . But to insert a record one by one for each Q, it requires db connection 10 times which can make the application slow.

    I hope i could clear the situation to some extent.
    please let me know if it made ne sense.

    Thanks

  2. #2
    Join Date
    Oct 2005
    Posts
    40

    Lightbulb

    Why not creat a single table with three columns
    1. Question -> Contains
    2. Choices -> Comma seperated list of choices
    3. Correct -> Correct choice

    Using above simple design you can make your application more expandable, for e.g. you can make number of choices vary and can include true, false type of questions.

    Hope it will help.

    Regards,
    Mohit

Similar Threads

  1. Replies: 1
    Last Post: 02-28-2005, 10:26 AM
  2. How would u do it (design question) ?
    By Joe in forum Database
    Replies: 17
    Last Post: 04-04-2003, 04:55 PM
  3. Replies: 1
    Last Post: 03-28-2002, 04:38 PM
  4. Accessing Access Database
    By jim in forum VB Classic
    Replies: 5
    Last Post: 03-23-2001, 12:53 PM
  5. Open Access database Form from VB 6.0?
    By Demo in forum VB Classic
    Replies: 7
    Last Post: 07-25-2000, 08:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center