Numeric Types

Integer and floating-point numbers are stored using MySQL's numeric column types. This section shows their storage requirements and their allowed value ranges. The ranges of integer types depend on whether they are declared as signed (the default) or unsigned (using the keyword UNSIGNED).

For all numeric column types, you may specify M, and for floating-point types, D as well. M is the display width of the column, and for floating-point types, D is the number of digits after the decimal point. (With the DECIMAL type, M and D are mandatory.)

All integer types can have the attributes UNSIGNED and AUTO_INCREMENT. From MySQL 4.0.2 onward, you can also make floating-point types UNSIGNED. All numeric types can have the attribute ZEROFILL ...

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.