Show Menu
Cheatography

MySQL Data Types Cheat Sheet (DRAFT) by

MySQL Data Types

This is a draft cheat sheet. It is a work in progress and is not finished yet.

String Types

VARCHAR(M)
L + 1 bytes if L <= 255 bytes, L + 2 bytes if L > 255
BLOB, TEXT
L + 2 bytes, where L < 2^16
ENUM('­val­ue1­','­val­ue2­',...)
1 or 2 bytes (65,535 values maximum)

Numeric Types

TINYINT
-128 to 127
1 byte
SMALLINT
-32768 to 32767
2 bytes
 

Date and Time Types

YEAR
1 byte
DATE
3 bytes
TIME
3 bytes + fractional seconds storage
DATETIME
5 bytes + fractional seconds storage
TIMESTAMP
4 bytes + fractional seconds storage