0% found this document useful (0 votes)
5 views3 pages

MySQL Data Types Reference

The document provides a comprehensive reference for MySQL data types, categorized into integer types, floating point types, string data types, date and time data types, binary data types, and a JSON data type. Each category includes specific data types along with their storage requirements, ranges, and descriptions. This reference is essential for understanding how to effectively use different data types in MySQL databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

MySQL Data Types Reference

The document provides a comprehensive reference for MySQL data types, categorized into integer types, floating point types, string data types, date and time data types, binary data types, and a JSON data type. Each category includes specific data types along with their storage requirements, ranges, and descriptions. This reference is essential for understanding how to effectively use different data types in MySQL databases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

MySQL Data Types Reference

1. Integer Types
Data Type Storage Range (Signed)

TINYINT 1 byte -128 to 127

SMALLINT 2 bytes -32,768 to 32,767

MEDIUMINT 3 bytes -8,388,608 to 8,388,607

INT / INTEGER 4 bytes -2,147,483,648 to


2,147,483,647

BIGINT 8 bytes -9 quintillion to +9


quintillion

2. Floating Point Types


Data Type Description

FLOAT(p) Approximate floating point number

DOUBLE / DOUBLE PRECISION Double-precision float

DECIMAL(p,s) / NUMERIC(p,s) Fixed-point with precision and scale (good


for money)

3. String Data Types


Data Type Max Length Description

CHAR(n) 255 bytes Fixed-length string

VARCHAR(n) 65,535 bytes Variable-length string

TINYTEXT 255 bytes Short text

TEXT 65,535 bytes Long text

MEDIUMTEXT 16 MB Very long text


LONGTEXT 4 GB Extremely long text

ENUM 1 or 2 bytes One value from a list (e.g.,


'small', 'medium', 'large')

SET 1–8 bytes Multiple values from a list

4. Date and Time Data Types


Data Type Description

DATE 'YYYY-MM-DD'

DATETIME 'YYYY-MM-DD HH:MM:SS' (no timezone)

TIMESTAMP Like DATETIME, but auto-updated and


timezone-aware

TIME 'HH:MM:SS'

YEAR Year in 4-digit format (e.g., 2025)

5. Binary Data Types


Data Type Max Size Description

BINARY(n) Fixed size Fixed-length binary

VARBINARY(n) Variable Variable-length binary

TINYBLOB 255 bytes Small binary object

BLOB 65 KB Binary Large Object

MEDIUMBLOB 16 MB Medium binary object

LONGBLOB 4 GB Large binary object

6. JSON Data Type


Data Type Description

JSON Stores and validates JSON data

You might also like