SQL Math Functions

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:

NameDescription
ABSReturns the absolute value
ACOSReturns the arc cosine of an argument
ASINReturns the arc sine of an argument
ATANReturns the arc tangent of an argument
CEIL,CEILINGRounds up a float to the nearest integer value
COSReturns the cosine of an argument
COTReturns the cotangent of an argument
EXPReturns the  e constant (2.71828…) that raises to a power of a specified number
LNReturns the natural logarithm of the argument
LOGReturns the natural logarithm of the first argument
LOG10Returns the base-10 logarithm of the argument
LOG2Returns the base-2 logarithm of the argument
MODReturns the remainder (modulo) of a number divided by another
PIReturns the value of pi which is 3.14159265358979
POWERReturns a number raised to a power of a specified number
RANDReturns a random floating-point value
ROUNDRounds a number to a specific precision
SIGNReturns the sign of an argument
SINReturns the sine of an argument
SQRTReturns the square root of an argument
TANReturns the tangent of an argument
TRUNCATETruncates to a specified number of decimal places