MySQL Data Types Reference

All MySQL column types with storage, range, and STRICT mode behavior.

Searchable MySQL and MariaDB data type reference covering integer, fixed and floating point, string, binary, date/time and JSON types — with storage size, value range and STRICT-mode notes.

What is the difference between DATETIME and TIMESTAMP?

DATETIME stores the literal value you give it, independent of time zone, with a wide range up to year 9999. TIMESTAMP is converted to UTC on write and back to the session time zone on read, but only spans 1970 to 2038.

Choose the right MySQL column type

MySQL and MariaDB provide integer, fixed and floating-point, string, binary, date/time and JSON types, each with its own storage cost and range. This reference lets you search those types by name or range and filter by category, so you can size each column correctly. It runs entirely in your browser.

How it works

Each entry shows the type, its category, the on-disk storage size and the value range, plus a note for types whose behaviour depends on time zone or SQL mode. Integer types come in five widths from TINYINT (1 byte) to BIGINT (8 bytes) and may be UNSIGNED. String and binary types split into inline CHAR/VARCHAR and off-page TEXT/BLOB families. A typical table uses several:

CREATE TABLE orders (
  id        BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  total     DECIMAL(12,2) NOT NULL,
  status    ENUM('new','paid','shipped') NOT NULL,
  created   DATETIME NOT NULL,
  payload   JSON
);

Tips and examples

  • Prefer the smallest integer type that fits expected values — narrower columns mean smaller indexes and faster scans.
  • VARCHAR(255) was historically common because of an index-prefix limit; with modern utf8mb4 and larger key lengths you can size it to the real maximum.
  • Add UNSIGNED to auto-increment primary keys to double the available id space.
  • When ordering by a TEXT/BLOB column you must specify a prefix length on the index, e.g. INDEX (body(100)).