Home  >  Article  >  Database  >  Describe the data types of mysql database in detail

Describe the data types of mysql database in detail

韦小宝
韦小宝Original
2018-03-14 15:37:221666browse

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

Integer type

##MEDIUMINT Signed values: -8388608 to 8388607 (-3INTSigned value: -4##BIGINTUnsigned values: 0

Floating point type


Data type Storage range Bytes
TINYINT Signed values: -128 to 127 (- to )
Unsigned values: 0 to 255 (0 to )
1
SMALLINT Signed values: -32768 to 32767 (-)
Unsigned value: 0 to 65535 (0 to #-1)
2
) None Signed value: 0 to 16777215 (0 to
)
Unsigned value: 0
-1
Signed value: -
## to -18
##Data typePrecisionFLOAT[(M,D)]6-7 decimal places (commonly used)##DOUBLE[ (M,D)]14-15 decimal places

Date time type

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

Character type

##VARCHAR(M)L+1 bytes , where L TINYTEXTL+1 bytes, where L<TEXTL+2 bytes, where L<#MEDIUMTEXT##LONGTEXTL+4 bytes, where L<
Column type Description
CHAR(M ) M bytes, 0<=M<=255, fixed length
L+3 bytes, where L<
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!

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