Table of Contents目录
MySQL supports SQL data types in several categories: numeric types, date and time types, string (character and byte) types, spatial types, and the MySQL支持几种类型的SQL数据类型:数字类型、日期和时间类型、字符串(字符和字节)类型、空间类型和JSON数据类型。JSON
data type. This chapter provides an overview and more detailed description of the properties of the types in each category, and a summary of the data type storage requirements. 本章提供了每个类别中类型属性的概述和更详细的描述,以及数据类型存储需求的摘要。The initial overviews are intentionally brief. Consult the more detailed descriptions for additional information about particular data types, such as the permissible formats in which you can specify values.最初的概述有意简短。有关特定数据类型的更多信息,如可以指定值的允许格式,请参阅更详细的说明。
Data type descriptions use these conventions:数据类型描述使用以下约定:
For integer types, 对于整数类型,M
indicates the maximum display width. M
表示最大显示宽度。For floating-point and fixed-point types, 对于浮点和定点类型,M
is the total number of digits that can be stored (the precision). M
是可以存储的总位数(精度)。For string types, 对于字符串类型,M
is the maximum length. M
是最大长度。The maximum permissible value of 最大允许值M
depends on the data type.M
取决于数据类型。
D
applies to floating-point and fixed-point types and indicates the number of digits following the decimal point (the scale). D
适用于浮点和定点类型,表示小数点后的位数(小数位数)。The maximum possible value is 30, but should be no greater than 最大可能值为30,但不应大于M
−2.M
-2。
fsp
applies to the TIME
, DATETIME
, and TIMESTAMP
types and represents fractional seconds precision; that is, the number of digits following the decimal point for fractional parts of seconds. fsp
适用于TIME
、DATETIME
和TIMESTAMP
类型,表示小数秒精度;也就是说,小数点后的位数是秒的小数部分。The fsp
value, if given, must be in the range 0 to 6. fsp
值(如果给定)必须在0到6之间。A value of 0 signifies that there is no fractional part. 值为0表示没有小数部分。If omitted, the default precision is 0. 如果省略,则默认精度为0。(This differs from the standard SQL default of 6, for compatibility with previous MySQL versions.)(为了与以前的MySQL版本兼容,这与标准SQL默认值6不同。)
Square brackets (方括号([
and ]
) indicate optional parts of type definitions.[
和]
)表示类型定义的可选部分。