title: What mysql database tables and relationships would support a Q&A survey with conditional questions?
body: <p>I'm working on a fairly simple survey system right now. The database schema is going to be simple: a <code>Survey</code> table, in a one-to-many relation with <code>Question</code> table, which is in a one-to-many relation with the <code>Answer</code> table and with the <code>PossibleAnswers</code> table.</p>
  
  <p>Recently the customer realised she wants the ability to show certain questions only to people who gave one particular answer to some previous question (eg. <em>Do you buy cigarettes?</em> would be followed by <em>What's your favourite cigarette brand?</em>, there's no point of asking the second question to a non-smoker).</p>
  
  <p>Now I started to wonder what would be the best way to implement this <em>conditional</em> questions in terms of my database schema? If <code>question A</code> has 2 possible answers: A and B, and <code>question B</code> should only appear to a user <strong>if</strong> the answer was <code>A</code>?</p>
  
  <p>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 ;) </p>