Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In order to understand what "Allow Null" means, you need to understand what <code>NULL</code> is, and understand that it is different to simply a zero or blank string.</p> <p><code>NULL</code> is a special value in SQL. It indicates data that does not exist. This is different to data that is blank.</p> <p>When you create a table in MySQL, it allows you to specify whether your fields are allowed to be <code>NULL</code>. If you specify "Allow Null", then it will be possible to create records with <code>NULL</code> values in those fields.</p> <p>This may be useful to you in some cases. For example, a Yes/No field may be a boolean value, but if the user didn't specify their preference, you may want to set to <code>NULL</code> to indicate this rather than defaulting to yes or no.</p> <p>In many cases though, allowing <code>NULL</code> can be problematic. Fields set to <code>NULL</code> can produce unexpected results in queries, because <code>NULL</code> does not follow the same rules as other values in all cases. eg: If you query the above example field <code>WHERE myfield != 1</code>, you may expect to get results for all the records which are not equal to 1. However <code>NULL</code> fields will not be returned; you need to write a special case for them.</p> <p><code>NULL</code> is also used as the default value when doing <code>JOIN</code> queries where some of the results do not have a record to join to. The unknown fields from the joined table will all be set to <code>NULL</code>.</p> <p>In general, if you're not sure what to do with "Allow Null", the safest option is to set it to no allow nulls.</p> <p>See the <a href="http://en.wikipedia.org/wiki/Null_%28SQL%29" rel="noreferrer">Wikipedia entry for NULL in SQL</a> for more info.</p> <p>Hope that helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload