This article talks about the data types of mysql database. If you don’t understand the data types of mysql database or are interested in the data types of mysql database, then we will Get up and read this article. Okay, let’s stop talking nonsense and get to the point
Data type | Storage range | Bytes | |||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
TINYINT | Signed values: -128 to 127 (-) Unsigned values: 0 to 255 (0 to ) |
1 | |||||||||||||||||||||||||||||||||||||||||||||
SMALLINT | Signed values: -32768 to 32767 (-) Unsigned value: 0 to 65535 (0 to #-1) |
2 | |||||||||||||||||||||||||||||||||||||||||||||
Signed values: -8388608 to 8388607 (- |
) None Signed value: 0 to 16777215 (0 to ) | 3||||||||||||||||||||||||||||||||||||||||||||||
Signed value: - | Unsigned value: 0 -1 | 4||||||||||||||||||||||||||||||||||||||||||||||
Signed value: - | Unsigned values: 0
## to -18 |
Precision | |||
---|---|---|---|
6-7 decimal places (commonly used) | |||
14-15 decimal places |
Date type | Storage space (bytes) | Date format | Range |
---|---|---|---|
datetime | 8 | YYYY-MM-DD HH:MM:SS | 1000-01-01 00:00:00 ~ 9999-12-31 23:59:59 |
timestamp | 4 | YYYY-MM-DD HH:MM:SS | 1970-01-01 00:00:01 ~ 2038 |
date | 3 | YYYY-MM-DD | 1000-01-01 ~ 9999-12-31 |
year | 1 | YYYY | 1901~2155 |
time | 2 | HH:MM:SS | -838:59:59 ~ 838:59:59 |
Column type | Description |
---|---|
CHAR(M ) | M bytes, 0<=M<=255, fixed length |
L+1 bytes , where L | |
L+1 bytes, where L< | |
L+2 bytes, where L< | |
L+3 bytes, where L< | ##LONGTEXT |
ENUM('value1','value2') | Enumeration, 1 or 2 bytes, depending on the number of enumerations (up to -1 value) |
The above is all the content of this article, if you don’t know much about it yet If so, it will be easy to master if you can realize more of both sides by yourself!
Related recommendations:
About the data types numeric and decimal_MySQL of mysql database
The above is the detailed content of Describe the data types of mysql database in detail. For more information, please follow other related articles on the PHP Chinese website!