Mathematical Functions
Function |
ABS |
Description |
Returns the absolute, positive value of the given numeric expression. |
Example |
SELECT ABS(-5), ABS(+5), ABS(5.5) |
Result |
5 5 5.5 |
* * * * *
Function |
CEILING |
Description |
Returns the smallest integer greater than, or equal to, the given numeric expression. |
Example |
SELECT CEILING(123.45), CEILING(-123.45), CEILING(0.00) |
Result |
124 -123 0 |
* * * * *
Function |
FLOOR |
Description |
Returns the largest integer less than or equal to the given numeric expression. |
Example |
SELECT FLOOR(123.45), FLOOR(-123.45), FLOOR($123.45) |
Result |
123 -124 123.0000 |
* * * * *
Function |
POWER |
Description |
Returns the value of the given expression to the specified power. |
Example |
SELECT POWER(5,2) |
Result |
OUTPUT: 25 |
* * * * *
Function |
ROUND |
Description |
Returns a numeric expression, rounded to the specified length or precision. |
Example |
SELECT ROUND(123.45,-1), ROUND(123.45,-2), ROUND(123.45,-3) |
Result |
120.00 100.00 .00 |
Example |
SELECT ROUND(555.75,1), ROUND(555.75,2), ROUND(555.75,3) |
Result |
OUTPUT: 555.80 555.75 555.75 |
|