I am using Mysql and php.
This is my table structure:=
+----+---------------+--------+--------+--------+--------+--------+--------+
| id | no_of_replies | reply1 | reply2 | reply3 | reply4 | reply5 | reply6 |
+----+---------------+--------+--------+--------+--------+--------+--------+
| -- | -- | | -- | -- | -- | -- | -- |
+----+---------------+--------+--------+--------+--------+--------+--------+
There are max six replies a user can give for a question.Most of the time user is giving 4-5 replies.i store the number of replies(no_of_replies) and all the replies(reply1,reply2,...). Mostly the reply5 and reply6 are NULL.
so when displaying data I have 2 options.
option1:- do single query and get all responses-
SELECT * FROM `responses` WHERE `id`='xyz'
option2:- do 2 queries and get required responses.
SELECT `no_of_repies` FROM `responses` WHERE `id`='xyz'
if result is 3
SELECT reply1
,reply2
,reply3
FROM responses
WHERE id
='XYZ'
NOTE:= I am asking this because this table is going to be used very often and needs to quickly give responses.