This article will see a detailed review of numeric data types.
1. BIT(size)
- This is a bit values type, and the number of bits per value is specified in size.
- The size parameter can hold a value from 1 to 64.
- The default size is 1
2. TINYINT(size)
- This is a very small integer.
- The signed Range is from -128 to 127.
- The unsigned range is from 0 to 255.
- The size parameter can hold max display width, which is 255.
3. BOOL
- 0 is false.
- Anything other than 0 is true.
4. BOOLEAN
- Same as BOOL.
5. SMALLINT(size)
- This is a small integer.
- The signed range is from -32768 to 32767.
- Unsigned from 0 to 65535.
- The size parameter can hold max display width, which is 255.
6. MEDIUMINT(size)
- This is a medium integer.
- The signed range is from -8388608 to 8388607.
- Unsigned from 0 to 16777215.
- The size parameter can hold max display width, which is 255.
7. INT(size)
- This is a medium integer.
- The signed range is from -2147483648 to 2147483647.
- Unsigned from 0 to 4294967295.
- The size parameter can hold max display width, which is 255.
8. INTEGER(size)
- Same as INT(size)
9. BIGINT(size)
- This is a large integer.
- The signed range is from -9223372036854775808 to 9223372036854775807.
- Unsigned from 0 to 18446744073709551615.
- The size parameter can hold max display width, which is 255.
10. FLOAT(size, d)
- This is a floating-point number.
- The number of digits is specified in size.
- The number of digits after the decimal point is specified in the d parameter.
- This will soon be deprecated in MySQL 8.0.17.
11. FLOAT(p)
- This is a floating-point number.
- MySQL used the p-value to let know whether to use FLOAT or DOUBLE.
- If p is from 0 to 24, it becomes FLOAT().
- If it is from 25 to 53, the data type becomes DOUBLE().
12. DOUBLE(size, d)
- This is a regular size floating-point number.
- The total number of digits is specified in size here.
13. DECIMAL(size, d)
- This is an exact fixed-point number.
- The total number of digits is specified in size here.
- The max number for size is 65.
- The max number for d is 30.
- The default value for size is 10.
- The default value for d is 0.
14. DEC(size, d)
- Same as DECIMAL(size, d)
- Log in to post comments