Data Type

MySQL supports SQL data types in several categories: numeric types, date and time types, string (character and byte) types, and spatial types. 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:

Numeric Data Type Syntax(数值数据类型语法)

For integer data types, M indicates the maximum display width. The maximum display width is 255. Display width is unrelated to the range of values a type can store.

对于 integer 数据类型,M 表示最大显示宽度。最大显示宽度为 255。显示宽度 与 类型可以存储的值的范围 无关。

For floating-point and fixed-point data types, M is the total number of digits that can be stored.

对于 浮点 和 有小数点 数据类型来说,M 是可存储的总位数。

If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column.

如果为 数值类型列 指定 ZEROFILL(补零),MySQL 会自动将 UNSIGNED 属性添加到该列中。