title: How are NULLs stored in a database?
body: <p>I'm curious to know how NULLs are stored into a database ?</p>
  
  <p>It surely depends on the database server but I would like to have an general idea about it.</p>
  
  <hr>
  
  <p>First try:</p>
  
  <p>Suppose that the server put a undefined value (could be anything) into the field for a NULL value.</p>
  
  <p>Could you be very lucky and retrieve the NULL value with</p>
  
  <pre><code>...WHERE field = 'the undefined value (remember, could be anything...)'
  </code></pre>
  
  <hr>
  
  <p>Second try:</p>
  
  <p>Does the server  have a flag or any meta-data somewhere to indicate this field is NULL ?</p>
  
  <p>Then the server must read this meta data to verify the field.</p>
  
  <p>If the meta-data indicates a NULL value and if the query doesn't have "field IS NULL",
  then the record is ignored.</p>
  
  <hr>
  
  <p>It seems too easy...</p>