Data types, storage requirements, and max values updated for mysql 5.7
|
Signed
|
Unsigned
|
Storage
|
|
|
TINYINT
|
127
|
255
|
1 byte
|
|
SMALLINT
|
32K
|
65K
|
2 bytes
|
|
MEDIUMINT
|
8M
|
16M
|
3 bytes
|
|
INT
|
231
|
232
|
4 bytes
|
|
BIGINT
|
263-1
|
264-1
|
8 bytes
|
|
FLOAT
|
4 bytes
|
||
|
DOUBLE
|
8 bytes
|
|
YEAR
|
1 byte
|
|
DATE
|
3 bytes
|
|
TIME
|
3 bytes + fractional seconds storage
|
|
DATETIME
|
5 bytes + fractional seconds storage
|
|
TIMESTAMP
|
4 bytes + fractional seconds storage
|
|
CHAR(
M) |
M bytes, up to 255 |
|
BINARY(
M) |
M bytes, up to 255 |
|
VARCHAR(
M) |
M + 1 bytes, up to 255 |
M + 2 bytes, more than 255 (65KB) |
|
|
TINYBLOB
|
L + 1 bytes, where L < 28 |
|
TINYTEXT
|
L + 1 bytes, where L < 28 (256B) |
|
TEXT
|
L + 2 bytes, where L < 216 (65KB) |
|
BLOB
|
L + 2 bytes, where L < 216 |
|
MEDIUMTEXT
|
L + 3 bytes, where L < 224 (16MB) |
|
MEDIUMBLOB
|
L + 3 bytes, where L < 224 |
|
LONGTEXT
|
L + 4 bytes, where L < 232 (4GB) |
|
LONGBLOB
|
L + 4 bytes, where L < 232 |
|
JSON
|
L + 4 bytes, where L < 232 |
|
ENUM
|
1 or 2 bytes (65K max values)
|
|
SET
|
1, 2, 3, 4, or 8 bytes (64 max values)
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.