MATH FUNCTIONS IN SQL
ABS() – Returns the non-negative value of a number – a positive number, removing any sign.
FLOOR() – Rounds a number downward to the closest integer less than or equal to it.
CEILING() – Rounds a number upward to the smallest integer greater than or equal to it.
SQUARE() – Outputs the result of multiplying a number by itself.
SQRT() – Gives the square root of the given number.
POWER(x, y) – Calculates x raised to the exponent y.
RAND() – Generates a random decimal value between 0 and 1.
ROUND(number, decimals, function) – Rounds a value to a defined number of decimal digits.
• number – The value that needs to be rounded.
• decimals – How many digits after the decimal point to keep (can be negative for rounding to
tens, hundreds, etc.).
• function –
0 or not given – Standard rounding (default).
1 – Cuts off the digits beyond the specified decimal without rounding (truncates).