MEDIUMINT

MEDIUMINT is a type of data type utilized in SQL which allows the storage of medium-sized integers. Aged for numeric columns in database tables, it can support a range of values, both positive and negative. Unsigned MEDIUMINT can accommodate larger positive values but does not support negative values. It is typically used when INT data type values prove too large for a specific data range. It takes less storage space compared to INT, which makes it an efficient choice for optimized databases.

Example

CREATE TABLE Employee(
emp_id MEDIUMINT,
);

Output

Query OK, 0 rows affected (0.01 sec)

Explanation

In the example provided, a table called ‘Employee’ is being created with one column ‘emp_id’. The data type assigned to ‘emp_id’ is MEDIUMINT. MEDIUMINT is a type of integer that can store values from -8388608 to 8388607, or 0 to 16777215 if unsigned.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.