SQL has many mathematical functions that allow you to perform business and engineering calculations.
Not all of the SQL math functions are used in typical day-to-day operations. However, there are several commonly used functions illustrated in the following table:
| Name | Description |
|---|---|
| ABS | Returns the absolute value |
| ACOS | Returns the arc cosine of an argument |
| ASIN | Returns the arc sine of an argument |
| ATAN | Returns the arc tangent of an argument |
| CEIL,CEILING | Rounds up a float to the nearest integer value |
| COS | Returns the cosine of an argument |
| COT | Returns the cotangent of an argument |
| EXP | Returns the e constant (2.71828…) that raises to a power of a specified number |
| LN | Returns the natural logarithm of the argument |
| LOG | Returns the natural logarithm of the first argument |
| LOG10 | Returns the base-10 logarithm of the argument |
| LOG2 | Returns the base-2 logarithm of the argument |
| MOD | Returns the remainder (modulo) of a number divided by another |
| PI | Returns the value of pi which is 3.14159265358979 |
| POWER | Returns a number raised to a power of a specified number |
| RAND | Returns a random floating-point value |
| ROUND | Rounds a number to a specific precision |
| SIGN | Returns the sign of an argument |
| SIN | Returns the sine of an argument |
| SQRT | Returns the square root of an argument |
| TAN | Returns the tangent of an argument |
| TRUNCATE | Truncates to a specified number of decimal places |