Numeric Column Types
MySQL can represent both integers (numbers with no fractional part) and floating-point numbers (those with a fractional part).
Table 5.1 shows the numeric column types.
Type Name | Range | Storage Required |
---|---|---|
TINYINT | signed: -128 to 127 | |
unsigned: 0 to 255 | 1 byte | |
SMALLINT | signed: -32768 to 32767 | |
unsigned: 0 to 65535 | 2 bytes | |
MEDIUMINT | signed: -8388604 to 8388607 | |
unsigned: 0 to 16777215 | 3 bytes | |
INT | signed: -2147483648 to 2147483647 (-231 to 231-1) | |
unsigned: 0 to 4294967295 (0 to 232-1) | 4 bytes | |
BIGINT | signed: -263 to 263-1 | |
unsigned: 0 to 264-1 | 8 bytes | |
FLOAT | minimum non-zero: ±1.175494351E-38 | |
maximum: ±3.402823466E+38 | 4 bytes | |
DOUBLE | minimum non-zero: ±2.2250738585072014E-308 | |
maximum: ±1.7976931348623157E+308 | 8 bytes ... |
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.