round 2 decimals mysql code example
Example 1: round one decimal place mysql
SELECT ROUND(20.555, 1);
-- 20.5
SELECT ROUND(20.5, 0);
-- 21
Example 2: sql limit decimal places
SELECT CAST(ROUND(125.025000, 2) AS NUMERIC(36,2))
returns: 125.03
SELECT ROUND(20.555, 1);
-- 20.5
SELECT ROUND(20.5, 0);
-- 21
SELECT CAST(ROUND(125.025000, 2) AS NUMERIC(36,2))
returns: 125.03