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