MySQL provides numeric types for integer and floating point values. Types may be chosen according to the range of values you need to represent.
For integer types, a column must be a PRIMARY KEY or a UNIQUE index if the AUTO_INCREMENT attribute is specified. Inserting NULL into an AUTO_INCREMENT column inserts a value that is one greater than the column's current maximum value. Negative values are not allowed for integer types if the UNSIGNED attribute is specified.
Values for numeric types are padded with leading zeroes to the column's display width if the ZEROFILL attribute is specified.
Allowable attributes. AUTO_INCREMENT, UNSIGNED, ZEROFILL
Range. –128 to 127 (–27 to 27–1), or 0 to 255 (0 to 28–1) if UNSIGNED
Allowable attributes. AUTO_INCREMENT, UNSIGNED, ZEROFILL
Range. –32768 to 32767 (–215 to 215–1), or 0 to 65535 (0 to 216–1) if UNSIGNED
Meaning. A medium-sized integer
Allowable attributes. AUTO_INCREMENT, UNSIGNED, ZEROFILL
Range. –8388608 to 8388607 (–223 to 223–1), or 0 to 16777215 (0 to 224–1) if UNSIGNED
Meaning. A normal-sized integer
Allowable attributes. AUTO_INCREMENT, UNSIGNED, ZEROFILL
Range. –2147483648 to 2147483647 (–231 to 231–1), or 0 to 4294967295 (0 to 232–1) if UNSIGNED
Allowable attributes. AUTO_INCREMENT, UNSIGNED, ZEROFILL
Range. –9223372036854775808 to 9223372036854775807 (–263 to 263–1), or 0 to 18446744073709551615 (0 to 264–1) if UNSIGNED
Meaning. A small floating-point number; single-precision (less precise than DOUBLE)
Allowable attributes. ZEROFILL
Range. Minimum non-zero values are ±1.175494351E–38; maximum non-zero values are ±3.402823466E+38
Default value. NULL if column can be NULL, 0 if NOT NULL
Synonyms. Prior to MySQL 3.23, FLOAT(4) is a synonym for FLOAT with the default M and D values.
Note. As of MySQL 3.23, FLOAT(4) is a true floating-point type (values are stored to the full precision allowed by your hardware, not rounded to the default number of decimal places).
Meaning. A large floating-point number; double-precision (more precise than FLOAT)
Allowable attributes. ZEROFILL
Range. Minimum non-zero values are ±2.2250738585072014E–308, maximum non-zero values are ±1.7976931348623157E+308
Default value. NULL if column can be NULL, 0 if NOT NULL
Synonyms. DOUBLE PRECISION[(M,D)] and REAL[(M,D)] are synonyms for DOUBLE[(M,D)] Prior to MySQL 3.23, FLOAT(8) is a synonym for DOUBLE with the default M and D values.
Note. As of MySQL 3.23, FLOAT(8) is a true floating-point type (Values are stored to the full precision allowed by your hardware, not rounded to the default number of decimal places.)
Meaning. A floating-point number, stored as a string (1 byte per digit, decimal point, or '-' sign).
Allowable attributes. ZEROFILL
Range. Maximum range is the same as for DOUBLE; effective range for a given DECIMAL type is determined by M and D. If D is 0, column values have no decimal point or a fractional part.
Default value. NULL if column can be NULL, 0 if NOT NULL
Storage required. M bytes for versions of MySQL earlier than 3.23, M+2 bytes for MySQL 3.23 and up
Note. As of MySQL 3.23, the value of M does not include the bytes needed for the sign character or decimal point, in conformance with ANSISQL.