MySQL Data Types

Reference guide.

MySQL Data Types

In MySQL there are three main data types: string, numeric, and date and time.

String Data Types

  • CHAR(size): Fixed length string.
  • VARCHAR(size): Variable length string.
  • TEXT: Long string.
  • BLOB: Binary Large OBject.

Numeric Data Types

  • INT: Integer.
  • FLOAT: Floating point number.
  • DECIMAL(p,s): Exact fixed-point number.
  • BOOL: Zero is false, non-zero is true.

Example

CREATE TABLE Demo (Name VARCHAR(255), Age INT, Price DECIMAL(10,2));