SQL Server Tutorial
Mathematical functions are used to perform mathematical operations.
ROUND function is used to round off the decimal values into specified digits.
SELECT ROUND(11.3425, 2)Output:
11.3400
returns numeric value with rounded off to 2 digits.
SELECT ROUND(11.3457, 2)Output:
11.3500
SELECT ROUND(11.3457, 1)Output:
11.3000
SELECT ROUND(11.3457, 0)Output:
11.0000
SELECT ROUND(11.3457, -1)Output:
10.0000
SELECT ROUND(11.3457, -2)Output:
0.00000
POWER function is used to calculate power to the specified value for numeric expression or value.
SELECT POWER(2, 5)Output:
32
SQRT function is used to calculate the square root of the specified numeric value.
SELECT SQRT(25)Output:
5
RAND function is used to generate the random numerical number between 0 to 1.
SELECT RAND()Output:
0.99059783387109
SIGN function is used to identify specified value is positive, negative or zero.
SELECT SIGN(200)Output:
1
SELECT SIGN(-200)Output:
-1
SELECT SIGN(0)Output:
0
EXP function is used to calculate exponential value for the specified value.
SELECT EXP()Output:
2.71828182845905
LOG Function is used to calculate natural logarithm of the specified value.
SELECT LOG(1)Output:
0
LOG10 Function is used to calculate base-10 logarithm of the specified value.
SELECT LOG10(10)Output:
1
FLOOR function is used to return largest integer which is less than or equal to specified value.
SELECT FLOOR(11.234)Output:
11
ABS function is used to return the absolute value.
SELECT ABS(11.234)Output:
11.234
SQL Server Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us | Report website issues in Github | Facebook page | Google+ page