Preamble
MySQL data types – Be sure to include the data type when choosing the columns for the table. Each column must have a specific data type. What values can be stored in a column and how much memory they will take up depend on the data type.
The following data types are available through MySQL and can be divided into different categories.
The various data types that MySQL can handle are listed below, including string, numeric, date/time, and large object.
String data types
The MySQL String data types are listed below:
| Syntax | Maximum size | Explanation |
| CHAR(size) | Size 255 characters | where size is the total number of characters saved. fixed-length strings. The additional characters in the area to the right are equal in number. |
| VARCHAR(size) | Size 255 characters | where size is the overall character count saved. variable length string |
| TINYTEXT(size) | Size 255 characters | where size is the overall character count saved. |
| TEXT(size) | Size 65535 characters | where size is the overall character count saved. |
| MEDIUMTEXT(size) | Size 16777215 characters | size is the number of characters that have been saved. |
| LONGTEXT(size) | Size 4Gb or 4294967295 characters | where size is the overall character count saved. |
| BINARY(size) | Size 255 characters | where size denotes how many binary characters should be stored. strings of a set length. A similar number of characters are added to the right-hand space. (Supported by MySQL 4.1.2.) |
| VARBINARY(size) | Size 255 characters | Size refers to the total number of characters saved. length-variable string (Shown in MySQL 4.1.2.) |
Starting with MySQL 5.6, the CHAR and VARCHAR data types use UTF-8 encoding by default. This lets you store up to 3 bytes per character, depending on the language (for example, 1 byte per character for many European languages, 2 bytes per character for some Eastern European and Middle Eastern languages, and 3 bytes per character for Chinese, Japanese, and Korean).
Numeric data types
The numeric data types in MySQL are listed below:
| Syntax | Maximum size | Explanation |
| BIT | very small integer value, equivalent to TINYINT (1). Numerical expression from -128 to 127 Positive number values range from 0 to 255. | |
| TINYINT(m) | It’s a very small integer value. Numerical expression from -128 to 127 Positive number values range from 0 to 255. | |
| SMALLINT(m) | small integer value. Numerical expression from -32768 to 32767 Positive numbers begin with 0 and go up to 65535. | |
| MEDIUMINT(m) | average integer value. numeric expression from -8388608 to 8388607. Positive numbers begin with 0 and go up to 16777215. | |
| INT(m) | standard integer value. Numerical expression from -2147483648 to 2147483647 Positive numbers begin with 0 and go up to 4294967295. | |
| INTEGER(m) | standard integer value. The signed values range from -2147483648 to 2147483647. Positive numbers begin with 0 and go up to 4294967295. | This is synonymous with the INT data type. |
| BIGINT(m) | a large integer value. The signed values range from -9223372036854775808 to 9223372036854775807. Positive values of numbers range from 0 to 18446744073709551615. | |
| DECIMAL(m,d) | a number with a fixed point. m by default—10 if not specified. d is 0 by default if not specified. | where m is the total number of digits and d is the number of digits after the decimal place. |
| DEC(m,d) | a number with a fixed point. m by default—10 if not specified. d is 0 by default if not specified. | where m is the total number of digits and d is the number of digits after the decimal place. This is synonymous with the decimal type. |
| NUMERIC(m,d) | a number with a fixed point. m by default—10 if not specified. d is 0 by default if not specified. | where m is the total number of digits and d is the number of digits after the decimal place. This is synonymous with the decimal type. |
| FIXED(m,d) | a number with a fixed point. m by default—10 if not specified. d is 0 by default if not specified. | where m is the total number of digits and d is the number of digits after the decimal place. (represented in MySQL 4.1) This is synonymous with the decimal type. |
| FLOAT(m,d) | a floating-point number with single precision. | where m is the total number of digits and d is the number of digits after the decimal place. |
| DOUBLE(m,d) | A floating-point number with double precision | where m is the total number of digits and d is the number of digits after the decimal place. This is synonymous with the double data type. |
| DOUBLE PRECISION(m,d) | A floating-point number with double precision | where m is the total number of digits and d is the number of digits after the decimal place. |
| REAL(m,d) | A floating-point number with double precision | where m is the total number of digits and d is the number of digits after the decimal place. This is synonymous with the double data type. |
| FLOAT(p) | a floating-point number. | where p is precision. |
| BOOL | TINYINT synonyms (1) | considered a boolean data type, where the value 0 is considered FALSE and any other value is considered TRUE. |
| BOOLEAN | TINYINT synonyms (1) | considered a boolean data type, where the value 0 is considered FALSE and any other value is considered TRUE. |
Date/Time data types
Below are the date / time data types in MySQL:
| Syntax | Maximum size | Conclusion value |
| DATE | The values range from ‘1000-01-01’ to ‘9999-12-31’. | ‘YYYY-MM-DD’. |
| DATETIME | The values range from ‘1000-01-01 00:00:00’ to ‘9999-12-31 23:59:59’. | ‘YYYY-MM-DD HH:MM:SS’. |
| TIMESTAMP(m) | The values range from ‘1970-01-01 00:00:01’ UTC to ‘2038-01-19 03:14:07’ UTC. | ‘YYYY-MM-DD HH:MM:SS’. |
| TIME | The values range from ‘-838: 59: 59’ to ‘838: 59’. | ‘HH:MM:SS’. |
| YEAR[(2|4)] | The value of the year as 2 or 4 digits. | The default value is 4 digits. |
Large Object (LOB) data types
The following is a list of large object (LOB) data types in MySQL:
| Syntax | Maximum size | Explanation |
| TINYBLOB | Maximum size 255 bytes. | |
| BLOB(size) | Maximum size 65 535 bytes. | Where size – number of stored characters (size is optional and was entered in MySQL 4.1) |
| MEDIUMBLOB | Maximum size 16,777,215 bytes. | |
| LONGTEXT | Maximum size 4 GB or 4 294 967 295 characters. |
What to use when choosing a data type of MySQL
Choose the general data class—such as numeric, string, or temporary—that is most appropriate for the column before choosing the data type for the column;
Next, you need to select a specific data type from those presented in the class. The same type of data can be stored using a number of different MySQL data types with different accuracy levels, value ranges, and physical space requirements (on disk or in memory). Some types display distinctive traits or behaviors.
The DATETIME and TIMESTAMP columns, for instance, can both store date and time information to the nearest second. On the other hand, the TIMESTAMP type takes up half as much space, allows for the use of time zones, and has special mechanisms for automatic updating. On the other hand, it has a much smaller acceptable range.
What to consider when selecting the data type:
- In general, smaller data types are faster because they occupy less CPU cache, memory, and disk space. Try to use data types with a minimum size sufficient for their correct storage and presentation.
- Since different encodings and sorting rules make character comparison more difficult, it makes sense to use integer data types for IP addresses. It is also preferable to store date and time values in built-in MySQL data types rather than in strings.
- The optimization of queries containing NULL columns causes additional difficulties for MySQL as they complicate the indexes, index statistics, and comparison of values. A column that allows NULL, takes more disk space, and requires special processing within MySQL. If there is a need to display in the table the fact that the value is absent, you can avoid using NULL by using other values, such as 0, a special value, or an empty row.
- It makes sense to use the same types of data in linked columns. Using different types of data in linked columns may slow down the processing of your request.
About Enteros
Enteros offers a patented database performance management SaaS platform. It finds the root causes of complex database scalability and performance problems that affect business across a growing number of cloud, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
How Enteros Transforms Healthcare Cost Management with AI Financial Intelligence and Database Performance Optimization
- 4 December 2025
- Database Performance Management
Introduction The healthcare sector is facing unprecedented financial and operational pressure. As medical organizations modernize their IT environments—embracing AI-driven diagnostics, telemedicine platforms, electronic health record (EHR) systems, imaging repositories, and cloud-native applications—the cost of operating these digital workloads continues to surge. At the same time, inefficiencies within databases, data pipelines, clinical software platforms, and analytics … Continue reading “How Enteros Transforms Healthcare Cost Management with AI Financial Intelligence and Database Performance Optimization”
Optimizing Retail Digital Operations: Enteros AI Platform for Accurate Cost Estimation and Superior Performance Management
Introduction The retail sector is undergoing one of the fastest digital transformations in history. From omnichannel commerce and predictive analytics to inventory automation and personalized customer experiences, today’s retail enterprises depend on complex, high-volume digital systems. These systems—spanning eCommerce platforms, databases, cloud services, POS solutions, and logistics software—process massive real-time workloads that directly influence customer … Continue reading “Optimizing Retail Digital Operations: Enteros AI Platform for Accurate Cost Estimation and Superior Performance Management”
How Technology Teams Improve Performance Management with Enteros’ AIOps and AI-First Operations Framework
- 3 December 2025
- Database Performance Management
Introduction The technology sector is undergoing a rapid transformation as cloud-native architectures, SaaS ecosystems, and real-time data systems redefine how organizations operate. Yet with this digital acceleration comes an overwhelming surge in complexity — distributed microservices, multi-cloud deployments, AI-augmented workflows, and massive data pipelines that demand precision, speed, and resilience. To navigate this complexity, enterprises … Continue reading “How Technology Teams Improve Performance Management with Enteros’ AIOps and AI-First Operations Framework”
The Future of Healthcare Databases: Enteros’ GenAI and AI Performance Management at Work
Introduction The healthcare sector is undergoing a digital revolution unlike anything seen before. From AI-assisted diagnostics and precision medicine to telehealth platforms and clinical research systems, today’s healthcare organizations rely heavily on massive data ecosystems. Databases power everything — electronic health records (EHRs), patient management systems, revenue cycle applications, insurance claim platforms, imaging archives, and … Continue reading “The Future of Healthcare Databases: Enteros’ GenAI and AI Performance Management at Work”