Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>sub_id is listed as a primary key</p> <p>From the <a href="http://dev.mysql.com/doc/refman/5.7/en/create-table.html" rel="nofollow">MySQL docs</a> (5.7, but other versions say the same thing):</p> <blockquote> <p>A PRIMARY KEY is a unique index where all key columns must be defined as NOT NULL. If they are not explicitly declared as NOT NULL, MySQL declares them so implicitly (and silently).</p> </blockquote> <p>As to the discussion about the Non-null columns having a Default of <code>NULL</code>...</p> <p>The <code>NULL</code> value in the <code>Default</code> column means that there is no default, not that the default is <code>NULL</code>.</p> <p>Fiddle: <a href="http://sqlfiddle.com/#!2/c718d/1" rel="nofollow">http://sqlfiddle.com/#!2/c718d/1</a></p> <p>If I create a simple table like so:</p> <pre><code>CREATE TABLE name_num( Number INT PRIMARY KEY, Name TEXT NOT NULL ); </code></pre> <p>And then do <code>desc name_num</code>, I get:</p> <pre><code>| FIELD | TYPE | NULL | KEY | DEFAULT | EXTRA | --------------------------------------------------- | Number | int(11) | NO | PRI | (null) | | | Name | text | NO | | (null) | | </code></pre> <p>Again, from the <a href="http://dev.mysql.com/doc/refman/5.7/en/data-type-defaults.html" rel="nofollow">MySQL docs</a>:</p> <blockquote> <p>If the column cannot take NULL as the value, MySQL defines the column with no explicit DEFAULT clause. Exception: If the column is defined as part of a PRIMARY KEY but not explicitly as NOT NULL, MySQL creates it as a NOT NULL column (because PRIMARY KEY columns must be NOT NULL), but also assigns it a DEFAULT clause using the implicit default value. To prevent this, include an explicit NOT NULL in the definition of any PRIMARY KEY column.</p> </blockquote>
    singulars
    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. This table or related slice is empty.
    1. 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