Skip to content

PRECISION

CREATE TABLE employees (
id INT NOT NULL,
salary DECIMAL(6,2)
);
INSERT INTO employees (id, salary)
VALUES (1, 5000.99), (2, 3000.20);
SELECT * FROM employees;
+------+---------+
| id | salary |
+------+---------+
| 1 | 5000.99 |
| 2 | 3000.20 |
+------+---------+

The DECIMAL(6,2) data type used in the salary column declaration denotes a fixed-point number with 6 digits in total, out of which 2 are decimal places. When 5000.99 and 3000.20 are inserted into the salary column of the employees table, it follows this pattern.