SQL Scalar Math Functions

Explore various mathematical functions available in SQL for performing calculations.

ABS() - Absolute Value

Returns the absolute value of a numeric expression.

Syntax: `ABS(expression)`

Example:

SELECT ABS(-10); -- Returns 10

Learn More

CEILING() - Ceiling Function

Rounds a number up to the nearest integer.

Syntax: `CEILING(expression)`

Example:

SELECT CEILING(3.14); -- Returns 4

Learn More

FLOOR() - Floor Function

Rounds a number down to the nearest integer.

Syntax: `FLOOR(expression)`

Example:

SELECT FLOOR(3.99); -- Returns 3

Learn More

ROUND() - Round Function

Rounds a number to a specified number of decimal places.

Syntax: `ROUND(expression, decimal_places)`

Example:

SELECT ROUND(3.14159, 2); -- Returns 3.14

Learn More

SQRT() - Square Root Function

Calculates the square root of a numeric expression.

Syntax: `SQRT(expression)`

Example:

SELECT SQRT(9); -- Returns 3

Learn More