ROUND(x, d) rounds to d places (a negative d rounds left of the point), TRUNCATE() cuts, FLOOR() and CEIL() go down and up, and ABS(), MOD(), POW(), SQRT() and RAND() do what their names say. FORMAT(x, d, locale) returns a display string. CAST(expr AS type) or CONVERT(expr, type) converts to SIGNED, UNSIGNED, DECIMAL(m,d), DOUBLE, FLOAT, CHAR, BINARY, DATE, DATETIME, TIME, YEAR or JSON.
SELECT FORMAT(SUM(price * stock), 2) AS inventory,
FORMAT(SUM(price * stock), 2, 'de_DE') AS de, ROUND(SUM(price * stock), -2) AS hundreds,
ROUND(2.5) AS r_dec, ROUND(2.5E0) AS r_dbl, TRUNCATE(4.99, 1) AS t, FLOOR(-4.2) AS fl
FROM products;
SELECT 0.1 + 0.2 = 0.3 AS dec_eq, 0.1E0 + 0.2E0 AS dbl_sum,
CAST(stock AS SIGNED) - 10 AS sold, CAST('39.90' AS DECIMAL(6,2)) * 3 AS dec3,
CAST(2.99 AS UNSIGNED) AS u, CAST(price AS CHAR) AS txt,
CONVERT('2026-09-23', DATE) + INTERVAL 1 DAY AS tmrw
FROM products WHERE sku = 'BK-SQL-02';+-----------+----------+----------+-------+-------+-----+----+ | inventory | de | hundreds | r_dec | r_dbl | t | fl | +-----------+----------+----------+-------+-------+-----+----+ | 4,528.00 | 4.528,00 | 4500 | 3 | 2 | 4.9 | -5 | +-----------+----------+----------+-------+-------+-----+----+ +--------+---------------------+------+--------+---+-------+------------+ | dec_eq | dbl_sum | sold | dec3 | u | txt | tmrw | +--------+---------------------+------+--------+---+-------+------------+ | 1 | 0.30000000000000004 | -10 | 119.70 | 3 | 29.00 | 2026-09-24 | +--------+---------------------+------+--------+---+-------+------------+
An exact value (DECIMAL, or a literal like 2.5) rounds half away from zero; an approximate one (2.5E0, a DOUBLE) follows the C library's round-half-to-even. Keep money in DECIMAL (DECIMAL vs FLOAT) and sums stay exact, as dec_eq shows. An integer cast rounds as well, so CAST(2.99 AS UNSIGNED) is 3. FORMAT() output no longer sorts or sums as a number, so format last, or in PHP when the locale comes from the visitor.