title: Mandatory fields in database
body: <p>I have created a database table like this:</p>
  
  <pre><code>CREATE TABLE test(
    name VARCHAR(30) NOT NULL, 
    password VARCHAR(40) NOT NULL);
  </code></pre>
  
  <p>I then added to it like this, which failed as expected.</p>
  
  <pre><code>INSERT INTO test(name, password) VALUES ('test', NULL);
  </code></pre>
  
  <p>But then when I tried this it inserted without a problem:</p>
  
  <pre><code>INSERT INTO test(name) VALUES ('test');
  </code></pre>
  
  <p>I tried to create the table differently but it didn't create:</p>
  
  <pre><code>CREATE TABLE test(
   name VARCHAR(30) NOT NULL, 
   password VARCHAR(40) NOT NULL DEFAULT NULL );
  </code></pre>
  
  <p>So is there a way to get that to create an error when inserting?</p>
  
  <p>Perhaps associated I think I will need to do something else to be able to validate data input into the database anyway and I think I saw something about constraints but I don't think these are supported in mysql? So is the null check and validation something I can't do the database with mysql?</p>