Skip to content

NUMERIC

CREATE TABLE Prices (
ID INT PRIMARY KEY,
Price NUMERIC(5, 2)
);
INSERT INTO Prices (ID, Price)
VALUES (1, 123.45), (2, 67.89);
SELECT * FROM Prices;
+----+-------+
| ID | Price |
+----+-------+
| 1 | 123.45|
| 2 | 67.89 |
+----+-------+

The NUMERIC type is used to store numbers with a large number of digits. Its precision is perfect, and is often used for financial or scientific calculations. In this case, a NUMERIC(5, 2) number could range, for example, from -999.99 to 999.99. The first parameter (total digits) is 5 and the second (digits after the decimal point) is 2.