Sql datatypes

From wikinotes
Revision as of 16:40, 6 March 2021 by Will (talk | contribs) (Created page with "{{ TODO | is this all SQL? or is this MySQL specific? }} {| class="wikitable" !colspan=2| Integers |- | <code>UNIQUE</code> || I need to lookup how this works....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

TODO:

is this all SQL? or is this MySQL specific?

Integers
UNIQUE I need to lookup how this works. IMPORTANT
BOOL (alias TRUE/FALSE to TINYINT)
TINYINT int (-128 to 127)
SMALLINT int (-32768 to 32767)
MEDIUMINT int (-8388608 to 8388607)
INT int (-2147483648 to 2147483647)
BIGINT int (-9223372036854775808 to 9223372036854775807)
Float & Double
FLOAT float (a very big number in scientific notation)
DOUBLE double (an even bigger number in scientific notation)
Dates
DATE 2014-01-01
DATETIME 2014-01-01 12:30:00
TIMESTAMP 1970-01-01 00:00:01 (seconds since UNIX EPOCH)
Strings
CHAR(4) store limited number of characters. byte size is equivalent to number of characters (maxLength 254)
VARCHAR(4) store limited number of characters. byte size only as large as needs to be (note that 1-2 bytes are used to store byte size) (maxLength 254)
BINARY(4) store limited number of binary characters. byte size is equivalent to number of characters (maxLength 254)
VARBINARY(4) store limited number of binary characters. Binary version of VARCHAR. (maxLength 254)
TINYBLOB/TINYTEXT Binary/String (maxLength 256 chars)
BLOB/TEXT Binary/String (maxLength 65536 chars)
MEDIUMBLOB/MEDIUMTEXT Binary/String (maxLength 16777216 chars)
LONGBLOB/LONGTEXT Binary/String (maxLength 4294967296 chars)