W3Schools MySQL Data Types Mastery Guide Complete Reference

Logan Jul 13, 2026

When working with MySQL, it's essential to understand the data types supported by this popular open-source relational database management system. Data types define the kind of data a column in a table can hold and the operations that can be performed on it. W3Schools offers a comprehensive table outlining MySQL data types, which we will explore in this article.

SQL Data Types
SQL Data Types

MySQL provides a wide range of data types, catering to various data needs. These can be broadly categorized into two: numerical and non-numerical data types.

SQL Cheat Sheet for Beginners | Essential Commands & Queries
SQL Cheat Sheet for Beginners | Essential Commands & Queries

Numerical Data Types

The numerical data types in MySQL include signed and unsigned integers, as well as floating-point numbers.

SQL Quick Notes Cheat Sheet | SQL Queries, Joins, Functions & Database Commands for Beginners
SQL Quick Notes Cheat Sheet | SQL Queries, Joins, Functions & Database Commands for Beginners

Signed integers can be negative, while unsigned integers are always non-negative. MySQL supports several lengths for integer data types, such as TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT, etc. The use of each depends on the range and precision required for your data.

TINYINT

SQL data
SQL data

The TINYINT data type can handle a range of -128 to 127 for signed integers and 0 to 255 for unsigned integers. It is best suited for single-digit integers.

Here's an example of creating a table with a TINYINT column:

```sql CREATE TABLE Users ( ID TINYINT PRIMARY KEY AUTO_INCREMENT, Age TINYINT ); ```

INT and BIGINT

SQL Essentials Cheat Sheet | The Only SQL Notes You'll Need for Revision
SQL Essentials Cheat Sheet | The Only SQL Notes You'll Need for Revision

MYSQL's INT data type can hold integers from -2147483648 to 2147483647. On the other hand, BIGINT supports a wider range, from -9223372036854775808 to 9223372036854775807.

To illustrate, here's how you can use INT and BIGINT:

```sql CREATE TABLE Orders ( ID INT PRIMARY KEY AUTO_INCREMENT, Quantity INT, TotalPrice BIGINT ); ```

The next category of numerical data types consists of floating-point numbers. MySQL offers FLOAT, DOUBLE, and DECIMAL data types. FLOAT and DOUBLE have limited precision, while DECIMAL can have a precision up to 65 decimal places.

SQL Data Types
SQL Data Types

Non-Numerical Data Types

MySQL also provides a variety of non-numerical data types, including character strings and binary strings.

SQL Commands
SQL Commands
25 SQL QUERIES EVERY DEVELOPER SHOULD KNOW
25 SQL QUERIES EVERY DEVELOPER SHOULD KNOW
Types Of Databases Chart, Database Data Types Chart, Understanding Database Types, Database Normalization Techniques, Types Of Database Systems, Different Types Of Databases, Types Of Databases, Database Parameter Types, Data Types
Types Of Databases Chart, Database Data Types Chart, Understanding Database Types, Database Normalization Techniques, Types Of Database Systems, Different Types Of Databases, Types Of Databases, Database Parameter Types, Data Types
the types of databases are shown in this graphic diagram, which shows how to use
the types of databases are shown in this graphic diagram, which shows how to use
SQL Joins Explained 🚀 | Beginner Data Analyst SQL Guide
SQL Joins Explained 🚀 | Beginner Data Analyst SQL Guide
7 SQL QUERIES EVERY STUDENT SHOULD MASTER
7 SQL QUERIES EVERY STUDENT SHOULD MASTER
an info sheet showing the different types of font and numbers for each type of text
an info sheet showing the different types of font and numbers for each type of text
Sql Cheat Sheet, Learn Sql, Learn Web Development, Excel Tutorials, Sql Server, Career Options, Data Analyst, Data Scientist, Data Analysis
Sql Cheat Sheet, Learn Sql, Learn Web Development, Excel Tutorials, Sql Server, Career Options, Data Analyst, Data Scientist, Data Analysis
a mind map with the words soi server data types in yellow and black on it
a mind map with the words soi server data types in yellow and black on it
SQL NULLIF() Explained with Examples | Prevent Divide by Zero Errors in SQL
SQL NULLIF() Explained with Examples | Prevent Divide by Zero Errors in SQL
Learn SQL Fast 🚀 | Beginner SQL Commands Cheat Sheet for Data Analysts
Learn SQL Fast 🚀 | Beginner SQL Commands Cheat Sheet for Data Analysts
SQl quick 1 min cheat sheet
SQl quick 1 min cheat sheet
SQL Cheat Sheet in 60 seconds 👇
SQL Cheat Sheet in 60 seconds 👇
the different types of data structures are shown in this graphic diagram, which shows how to use
the different types of data structures are shown in this graphic diagram, which shows how to use
SQL Cheat Sheet for Beginners
SQL Cheat Sheet for Beginners
Ultimate SQL Commands Cheat Sheet
Ultimate SQL Commands Cheat Sheet
a poster with different types of programming and data types on the front, including numbers, symbols
a poster with different types of programming and data types on the front, including numbers, symbols
SQL Joins Cheat Sheet Every Developer Should Save
SQL Joins Cheat Sheet Every Developer Should Save
Types of database
Types of database
an orange and white poster with the names of different types of items on it's side
an orange and white poster with the names of different types of items on it's side

CHAR and VARCHAR

CHAR and VARCHAR are the most common string data types. CHAR has a fixed length, while VARCHAR has a variable length, making it more space-efficient for storing shorter strings. Both these types can store string data of up to 255 characters.

Let's create a table with a VARCHAR column:

```sql CREATE TABLE Employees ( Name VARCHAR(50), Email VARCHAR(100) ); ```

ENUM and SET

gica-mysql-data-typesexclude ENUM and SET are specialized string data types designed for scenarios where a column can only take on a predefined set of values. ENUM is useful when you want to restrict a column to a short list of values, while SET is better suited for columns that can take on multiple values from a larger predefined list.

Here's an example of using ENUM:

```sql CREATE TABLE Customers ( Country ENUM('US', 'UK', 'DE', 'FR') ); ```

While using SET:

```sql CREATE TABLE Products ( Categories SET('Electronics', 'Fashion', 'Books', 'Sports') ); ```

Understanding and effectively using MySQL data types are essential for designing efficient and high-performing databases. As you dive deeper into MySQL, remember to always choose the right data type for your needs to ensure optimal storage and retrieval speeds.

Happy coding, and may your databases scale seamlessly!