title: MySQL default value on NULL
body: <p>I have the following table: </p>
  
  <pre><code>CREATE TABLE `Foo` (
    `id`         int NOT NULL,
    `FirstName`  varchar(255) NULL,
    `LastName`   varchar(255) NOT NULL DEFAULT 'NONE',
    PRIMARY KEY (`id`)
  );
  </code></pre>
  
  <p>When I run the following query it take the default value of <code>'NONE'</code>:</p>
  
  <pre><code>INSERT INTO Foo (`FirstName`) VALUES('FOO');
  </code></pre>
  
  <p>When I run the following query: </p>
  
  <pre><code>INSERT INTO Foo (`FirstName`, `LastName`) VALUES('FOO', NULL);
  </code></pre>
  
  <p>it gives an error:</p>
  
  <blockquote>
    <p><code>[Err] 1048 - Column 'LastName' cannot be null</code></p>
  </blockquote>
  
  <p><br>
  What I want to achieve is that if a value is <code>NULL</code> then MySQL should use the <em>DEFAULT</em> value.<br>
  Does anybody know the solution?</p>