MySQL type sizes

Август 27th, 2012 | Posted by elenst in Pensieve

Another piece of trivia which sometimes is not easy to find fast, and which easily gets demoted into the cold cache (if that) of my brain when isn’t used.

CHAR(M) 255 characters
VARCHAR(M) 65,535 characters
TINYTEXT 255 characters
TEXT 65,535 characters
MEDIUMTEXT 16,777,215 characters
LONGTEXT 4,294,967,295 characters
BINARY 255 bytes
VARBINARY 65,535 bytes
TINYBLOB 255 bytes
BLOB 65,535 bytes
MEDIUMBLOB 16,777,215 bytes
LONGBLOB 4,294,967,295 bytes
TINYINT -128 — 127
TINYINT UNSIGNED 255
SMALLINT -32,768 — 32,767
SMALLINT UNSIGNED 65,535
MEDIUMINT -8,388,608 — 8,388,607
MEDIUMINT UNSIGNED 16,777,215
INT -2,147,683,648 — 2,147,683,647
INT UNSIGNED 4,294,967,295
BIGINT -9,223,372,036,854,775,808 — 9,223,372,036,854,775,807
BIGINT UNSIGNED 18,446,744,073,709,551,615
FLOAT precision 0..23
DOUBLE precision 24..53
DECIMAL 65 digits
ENUM 65,635 members
SET 64 members
BIT 1..64 bits
DATE 1000-01-01 — 9999-12-31
TIME -838:59:59 — 838:59:59
DATETIME 1000-01-01 00:00:00 — 9999-12-31 23:59:59
TIMESTAMP 1970-01-01 00:00:00, 1970-01-01 00:00:01 — 2038-01-19 03:14:07 UTC
YEAR(4) 1901 — 2155
YEAR(2) 1970 — 2069

You can follow any responses to this entry through the RSS 2.0 Both comments and pings are currently closed.