MySQL Datatypes
Datatype | Storage for y bytes | Maximum Size | |
CHAR(x) | x | 255 | |
VARCHAR(x) | y+1 | 255 | |
TINYTEXT(x) | y+1 | 255 | |
TEXT(x) | y+2 | 65,535 | (64 KB) |
MEDIUMTEXT(x) | y+3 | 16,777,215 | (16.7 MB) |
LONGTEXT(x) | y+4 | 4,294,967,295 | (4 GB) |
Datatype | Size in bytes | Low | High | Range |
TINYINT (signed) | 1 | -128 | 127 | 256 |
TINYINT (unsigned) | 1 | 0 | 255 | |
SMALLINT (signed) | 2 | -32,768 | 32,767 | 65 thousand |
SMALLINT (unsigned) | 2 | 0 | 65,535 | |
MEDIUMINT (signed) | 3 | -8,388,608 | 8,388,607 | 16.8 million |
MEDIUMINT (unsigned) | 3 | 0 | 16,777,215 | |
INT (signed) | 4 | -2,147,483,648 | 2,147,483,647 | 4.3 billion |
INT (unsigned) | 4 | 0 | 4,294,967,295 | |
BIGINT (signed) | 8 | -9,223,372,036,854,775,808 | 9,223,372,036,854,775,807 | 18.4 billion billion |
BIGINT (unsigned) | 8 | 0 | 18,446,744,073,709,551,615 |
Datatype | Size in bytes | Maximum Value | Minimum Value |
FLOAT | 4 | +/- 3.402823466 e38 | +/- 1.175494351 e-38 |
DOUBLE | 8 | +/- 1.7976931348623157 e308 | +/- 2.2250738585072014 e-308 |
Datatype | Size in bytes | Minimum Value | Maximum Value |
DATETIME | 8 | 1000-01-01 00:00:00 | 9999-12-31 23:59:59 |
DATE | 3 | 1000-01-01 | 9999-12-31 |
TIMESTAMP | 4 | ? | ? |
TIME | 3 | -838:59:59 | 838:59:59 |
YEAR | 1 | 1901 | 2155 |