MySQL provides a variety of data types, including numerical types (TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT, FLOAT, DOUBLE, DECIMAL), character types (CHAR, VARCHAR, TEXT, BLOB), and time types (DATE, TIME, DATETIME, TIMESTAMP), collection types (SET, ENUM), and other types (JSON, BOOL).
Data types provided in MySQL
MySQL is a relational database management system that provides a variety of data Types to store different types of information. Here are some common data types:
Numeric type
-
TINYINT: 1-byte signed integer, range -128 to 127
-
SMALLINT: 2-byte signed integer, range -32,768 to 32,767
-
MEDIUMINT: 3-byte signed integer, Range is -8,388,608 to 8,388,607
-
INT: 4-byte signed integer, range is -2,147,483,648 to 2,147,483,647
-
BIGINT: 8-byte Signed integer, ranging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
-
FLOAT: 4-byte floating point number with 7-digit precision
-
DOUBLE: 8 words Node floating point number with 15 digits of precision
-
DECIMAL: Fixed precision decimal of any precision
Character type
-
CHAR(n): Fixed-length character data, n specifies the number of characters
-
VARCHAR(n): Variable-length character data, n Specify the maximum number of characters
-
TEXT: Very long text data
-
BLOB: Very long binary data
Time type
-
DATE: Date, format is YYYY-MM-DD
-
TIME: Time , the format is HH:MM:SS
-
DATETIME: date and time, the format is YYYY-MM-DD HH:MM:SS
-
TIMESTAMP: Timestamp with time zone, in the format YYYY-MM-DD HH:MM:SS.SSS
##Collection type
- SET(value1, value2, ...): Stores a series of non-repeating values
- ENUM(value1, value2, ...): Stores a series of discrete values , each value can only have one
Other types
- JSON: used to store JSON data
- BOOL: Boolean value, can be TRUE or FALSE
The above is the detailed content of What data types are provided in mysql?. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn