2,187
edits
(→CREATE / ALTER Tables: Added further ALTER examples) |
(→Data Types: Added Strings) |
||
Line 47: | Line 47: | ||
== Data Types == | == Data Types == | ||
=== Numbers === | === Numbers === | ||
Line 80: | Line 74: | ||
| <code> BIGINT UNSIGNED </code> || 8 || 0 || 18446744073709551615 | | <code> BIGINT UNSIGNED </code> || 8 || 0 || 18446744073709551615 | ||
|} | |} | ||
=== Strings === | |||
There's two main string types | |||
* '''<code>VARCHAR</code>''' - Variable character length up a prescribed maximum (eg <code>VARCHAR(32)</code>). Max allowed is 65,535 (though in reality this max width is shared across all columns so is less in practice. | |||
* '''<code>CHAR</code>''' - Fixed character length up a prescribed maximum (eg <code>CHAR(32)</code>). Max allowed is 255 | |||
=== NULL === | |||
NULL means "no data", it doesn't mean zero. Therefore 0 <> NULL in an numerical field, and "NULL" <> NULL in a string field. | |||
To set a field to NULL, use NULL without any quotes eg... | |||
<source lang="mysql">INSERT INTO table (col1, col2) VALUES ('data1', NULL); </source> | |||
=== IP Addresses === | === IP Addresses === |