TECH SUPPORT
MySQL Data Types
| Type | Use for | Size |
|---|---|---|
|
TINYINT |
A very small integer |
The signed range is 128 to 127. |
|
SMALLINT |
A small integer |
The signed range is 32768 to 32767. |
|
MEDIUMINT |
A medium-size integer |
The signed range is 8388608 to 8388607. |
|
INT or INTEGER |
A normal-size integer |
The signed range is 2147483648 to 2147483647. |
|
BIGINT |
A large integer |
The signed range is 9223372036854775808 |
|
FLOAT |
A small (single-precision) |
Ranges are 3.402823466E+38 to 1.175494351E-38, 0 and
1.175494351E-38 |
|
DOUBLE, |
A normal-size (double-precision) |
Ranges are -1.7976931348623157E+308 to -2.2250738585072014E-308,
0 and 2.2250738585072014E-308 to 1.7976931348623157E+308. |
|
DECIMAL, |
An unpacked floating-point number. |
Behaves like a CHAR column: "unpacked" means the number is stored
as a string, using one character for each digit of the value.
|
|
DATE |
A date |
The supported range is '1000-01-01' to '9999-12-31'. MySQL displays DATE values in 'YYYY-MM-DD' format |
|
DATETIME |
A date and time combination |
The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. MySQL displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format |
|
TIMESTAMP |
A timestamp |
The range is '1970-01-01 00:00:00' to sometime in the year 2037. |
|
TIME |
A time |
The range is '-838:59:59' to '838:59:59'. |
|
YEAR |
A year in 2- or 4- digit formats |
The allowable values are 1901 to 2155, and 0000 in the 4 year
format and 1970-2069 if you use the 2 digit format (70-69). |
|
CHAR |
A fixed-length string that is always |
The range of Length is 1 to 255 characters. |
|
VARCHAR |
A variable-length string. Note: Trailing spaces are removed when the value is stored (this differs from the ANSI SQL specification) |
The range of Length is 1 to 255 characters. VARCHAR values are sorted and compared in case-insensitive fashion unless the BINARY keyword is given |
|
TINYBLOB, |
A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters |
|
|
BLOB, |
A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters |
|
|
MEDIUMBLOB, |
A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters |
|
|
LONGBLOB, |
A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters |
|
|
ENUM |
An enumeration |
A string object that can have only one value, chosen from the list of values 'value1', 'value2', ..., or NULL. An ENUM can have a maximum of 65535 distinct values. |
|
SET |
A set |
A string object that can have zero or more values, each of which must be chosen from the list of values 'value1', 'value2', ... A SET can have a maximum of 64 members |
