Arithmetic Functions
Function: abs(numeric_expr)
This function returns the absolute value of the numeric expression.
SELECT abs(5 - 7), abs(-2), abs(2)
|
--> 2, 2, 2
Function: ceil(numeric_expr)
This function returns the numeric expression rounded up to nearest whole number.
SELECT ceil(13 / 2), ceil(6.5)
|
--> 7, 7
Function: floor(numeric_expr)
This function returns the numeric expression rounded down to the nearest whole number.
SELECT floor(13 / 2), floor(6.5)
|
--> 6, 6
Function: pow(numeric_expr1, numeric_expr2)
This function raises the first numeric expression to the power of the second numeric expression and returns the result.
SELECT pow(3 , 2), pow(3 , -2)
|
--> 9, 0.11111111111
Function: round(numeric_expr)
This function returns the numeric expression rounded up or down to the nearest whole number.
SELECT round(6.5), round(6.49), round(6.51)
|
--> 7, 6, 7
Function: sqrt(numeric_expr)
This function returns the square root of the numeric expression.
SELECT sqrt(36)
|
--> 6