title: MySQL comparison with null value
body: <p>I have a column called CODE in a MySQL table which can be NULL. Say I have some rows with CODE='C' which I want to ignore in my select result set. I can have either CODE=NULL or CODE!='C' in my result set.</p>
  
  <p>The following query does not return a row with CODE as NULL:</p>
  
  <pre><code>SELECT * from TABLE where CODE!='C'
  </code></pre>
  
  <p>But this query works as expected and I know it is the right way to do it.</p>
  
  <pre><code>SELECT * from TABLE where CODE IS NULL OR CODE!='C'
  </code></pre>
  
  <p>My question is why does having only CODE!='C' does not return rows where CODE=NULL? Definitely 'C' is not NULL. We are comparing no value to a character here. Can someone throw some light as why it doesn't work that way?</p>