MYSQL Numeric Data Types

This tutorial will help you to understand about “MYSQL Numeric Data Types”.

Storage Required For Numeic Types

Data Type Storage Required
TINY INT 1 byte
SMALL INT 2 bytes
MEDIUM INT 3 bytes
INT INTEGER 4 bytes
BIGINT 8 bytes
FLOAT(p) 4 bytes
DOUBLE[PRECISION], REAL 8 bytes
DECIMAL(M,D), NUMERIC(M,D) Various see the below details
BIT(M) approximately(M+7)/ 8 bytes

Values for decimal, numeric,

  1. Storage for the integer and fractional parts of each value are determined separately.
  2. Each multiple of nine digits requires four bytes and “leftover” digits require some fraction of four bytes. The storage required for excess digits is given by the following table.
Leftover Digits Number Of Bytes
0 0
1 1
2 1
3 2
4 2
5 3
6 3
7 4
8 4

Integer Types

MYSQL supports INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT integer data types.
The following table will give the details of mysql storage and range for each integer type

Type Storage Minimum Value Maximum Value
Bytes Signed/Unsigned Signed/Unsigned
TINYINT 1 -128 127
0 255
SMALLINT 2 -32768 32767
0 65535
MEDIUMINT 3 -8388608 8388607
0 16777215
INT/ INTEGER 4 -2147483648 2147483647
0 4294967295
BIGINT 8 -9223372036854775808 9223372036854775807
0 18446744073709551615