title: Mysql polymorphic tables?
body: <p>The needs would be long to describe, so I'll simplify the example.</p>
  
  <p>I want to make a form creation system ( the user can create a form, adding fields, etc... ). Let's focus on checkbox vs textarea.</p>
  
  <p>The checkbox can have a value of 0 or 1, depending on the checked status.
  The textarea must be a LONGTEXT type.</p>
  
  <p>So in the database, that give me 3 choices concerning the structure of the table field_value:</p>
  
  <p>1.</p>
  
  <pre><code>checkbox_value (TINYINT) | textarea_value (MEDIUMTEXT)
  </code></pre>
  
  <p>That mean that no input will ever use all column of the table. The table will waste some space.</p>
  
  <p>2.</p>
  
  <pre><code>allfield_value (MEDIUMTEXT)
  </code></pre>
  
  <p>That mean that for the checkbox, I'll store a really tiny value in a MEDIUMTEXT, which is useless.</p>
  
  <p>3.</p>
  
  <pre><code>tblcheckbox.value
  tbltextarea.value
  </code></pre>
  
  <p>Now I have 1 separate table per field. That's optimal in terms of space, but in the whole context of the application, I might expect to have to read over 100 tables -- 1 query with a many JOIN ) in order to generate a single page that display a form.</p>
  
  <p>In your opinion, what's the best way to proceed?</p>