title: (my)SQL database - storing different types of same value
body: <p>I need to store different types of same value. The Value can represent DATE, INT, BOOLEAN, DOUBLE and any other type. I'm wondering if it is possible <strong>not using</strong> multiple tables - each for different type (I suppose that it would significantly complicate usage of stored Values (mainly searching, filtering)). Would it be a big storage and performance degradation when storing multiple column table with mainly NULL values in a row?</p>
  
  <p>I'm thinking of table with such example columns from which only one value column will be filled:</p>
  
  <pre><code>id valueVarchar  valueDate  valueBoolean  valueInt  valueDouble
  </code></pre>
  
  <p>If that approach is clearly wrong please enlighten me.</p>
  
  <p>I'm creating JSF application using MySQL (InnoDB) (database is not a big issue, it can be changed if necessary) and JPA.</p>
  
  <p><strong>edit:</strong></p>
  
  <p>As for now I have one table with one text value field. I'm converting values to/from database on server side. Because the project has just recently been started and changing model now will be less painful than in the future, I'm considering existence of better approach.</p>