I'm working on a fairly simple survey system right now. The database schema is going to be simple: a Survey
table, in a one-to-many relation with Question
table, which is in a one-to-many relation with the Anwser
table and with the PossibleAnwsers
table.
Recently the customer realised she wants the ability to show certain questions only to people who gave one particular anwser to some previous question (eg. Do you buy cigaretes? would be followed by What's your favourite cigarete brand?, there's no point of asking the second question to a non-smoker).
Now I started to wonder what would be the best way to implement this conditional questions in terms of my database schema? If question A
has 2 possible anwsers: A and B, and question B
should only appear to a user if the anwser was A
?
Edit: What I'm looking for is a way to store those information about requirements in a database. The handling of the data will be probably done on application side, as my SQL skills suck ;)