SQL Math Functions
Published May 23, 2023
Contribute to Docs
In SQL, math functions are built-in features which perform mathematical operations and complex calculations directly in database queries. This makes it possible to work with numerical data in SQL rather than extracting the data and processing it separately.
Below is a list of math functions that can be used in various SQL platforms:
Math Functions
- ABS()
- Outputs the positive equivalent of a numeric argument.
- ACOS()
- Returns the arccosine of a given angle.
- ASIN()
- Returns the arcsine of a number.
- ATAN()
- Returns the arctangent of a provided number.
- CEILING()
- Rounds up a numeric value to the next highest integer.
- COS()
- Calculates the cosine trigonometric function of a specified angle in radians.
- DEGREES()
- Converts an angle from radians to degrees.
- EXP()
- Returns the value of e raised to the power of given number.
- FLOOR()
- Rounds down a number to the nearest whole integer.
- LOG()
- Calculates the base-e logarithm of the specified numeric input.
- LOG10()
- Calculates the base-10 logarithm of a number.
- MOD()
- Returns the remainder of one number divided by another.
- PI()
- Returns the mathematical constant π (PI).
- POWER()
- Returns the value of a number raised to the power of another number.
- RADIANS()
- Converts a numeric value from degrees to radians in SQL.
- ROUND()
- Returns the number rounded to the specified number of decimal places.
- SIN()
- Returns the sine of an angle.
- SQRT()
- Computes the non-negative root that, when squared, equals the input value.
- TAN()
- Returns the tangent for a given angle in radians.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SQL on Codecademy
- Learn to analyze data with SQL and prepare for technical interviews.
- Includes 9 Courses
- With Certificate
- Beginner Friendly.18 hours
- In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.
- Beginner Friendly.5 hours