🧮 Numeric Functions in SQL
Last Updated: January 2026
The NUMERIC FUNCTION is a function that operates on numeric values and returns a numeric value.
Most Common Numeric Functions
ABS()
- Returns the absolute value of a number.
SELECT ABS(-5); -- Output: 5
ROUND()
- Rounds a number to a specified number of decimal places.
/*
Round(number, decimal_places)
*/
SELECT ROUND(3.14159, 2);
-- Output: 3.14
CEIL()
- Returns the smallest integer greater than or equal to a number.
/*
Ceil(number)
*/
SELECT CEIL(3.7);
-- Output: 4
FLOOR()
- Returns the largest integer less than or equal to a number.
/*
Floor(number)
*/
SELECT FLOOR(3.7);
-- Output: 3
MOD()
- Returns the remainder of a division operation.
/*
Mod(dividend, divisor)
*/
SELECT MOD(10, 3);
-- Output: 1
POWER()
- Raises a number to a specified power.
/*
Power(base, exponent)
*/
SELECT POWER(2, 3);
-- Output: 8
RANDOM()
- Returns a random number between 0 and 1.
SELECT RANDOM();
-- Output: Random number between 0 and 1