Mathematical Functions



Mathematical Functions in SQL Server


The following scalar math functions perform a calculation, usually based on input values that are provided as arguments, and return a numeric value.

* Arithmetic functions, such as ABS, CEILING, DEGREES, POWER, RADIANS, and SIGN, return a value having the same data type as the input value.

All the functions are listed below:

FunctionDescription
ABSA mathematical function that returns the absolute (positive) value of the specified numeric expression
Syntax:

ABS ( numeric_expression )
FunctionDescription
ACOSA mathematical function that returns the angle, in radians, whose cosine is the specified float expression; also called arccosine.
Syntax:

ACOS ( float_expression )
FunctionDescription
ASINReturns the angle, in radians, whose sine is the specified float expression. This is also called arcsine.
Syntax:

ASIN ( float_expression )
FunctionDescription
ATANReturns the angle in radians whose tangent is a specified float expression. This is also called arctangent.
Syntax:

ATAN ( float_expression )
FunctionDescription
ATN2Returns the angle, in radians, between the positive x-axis and the ray from the origin to the point (y, x), where x and y are the values of the two specified float expressions.
Syntax:

ATN2 ( float_expression, float_expression )
FunctionDescription
CEILINGReturns the smallest integer greater than, or equal to, the specified numeric expression.
Syntax:

CEILING ( numeric_expression )
FunctionDescription
COSIs a mathematical function that returns the trigonometric cosine of the specified angle, in radians, in the specified expression.
Syntax:

COS ( float_expression )
FunctionDescription
COTA mathematical function that returns the trigonometric cotangent of the specified angle, in radians, in the specified float expression.
Syntax:

COT ( float_expression )
FunctionDescription
DEGREESReturns the corresponding angle in degrees for an angle specified in radians.
Syntax:

DEGREES ( numeric_expression )
FunctionDescription
EXPReturns the exponential value of the specified float expression.
Syntax:

EXP ( float_expression )
FunctionDescription
FLOORReturns the largest integer less than or equal to the specified numeric expression.

Syntax:

FLOOR ( numeric_expression )
FunctionDescription
LOGReturns the natural logarithm of the specified float expression.
Syntax:

LOG ( float_expression )
FunctionDescription
LOG10Returns the base-10 logarithm of the specified float expression.
Syntax:

LOG10 ( float_expression )
FunctionDescription
PIReturns the constant value of PI.
Syntax:

PI ()
FunctionDescription
POWERReturns the value of the specified expression to the specified power.
Syntax:

POWER ( float_expression, y )
FunctionDescription
RADIANSReturns radians when a numeric expression, in degrees, is entered.
Syntax:

RADIANS ( numeric_expression )
FunctionDescription
RANDReturns a pseudo-random float value from 0 through 1, exclusive.
Syntax:

RAND ( [ seed ] )
FunctionDescription
ROUNDReturns a numeric value, rounded to the specified length or precision.
Syntax:

ROUND ( numeric_expression, length [ , function ] )
FunctionDescription
SIGNReturns the positive (+1), zero (0), or negative (-1) sign of the specified expression.
Syntax:

SIGN ( numeric_expression )
FunctionDescription
SINReturns the trigonometric sine of the specified angle, in radians, and in an approximate numeric, float, expression.
Syntax:

SIN ( float_expression )
FunctionDescription
SQRTReturns the square root of the specified float value.
Syntax:

SQRT ( float_expression )
FunctionDescription
SQUAREReturns the square of the specified float value.
Syntax:

SQUARE ( float_expression )
FunctionDescription
TANReturns the tangent of the input expression.
Syntax:

TAN ( float_expression )

Connection String

SQL Server Connection String Formats

posted on 2019-08-27 05:53:53 - SQL Server Tutorials


UNION

union in SQL server

posted on 2019-08-09 23:05:33 - SQL Server Tutorials


System Functions

System Functions in SQL Server

posted on 2019-08-09 06:14:33 - SQL Server Tutorials


Prompt Examples

ChatGPT Prompt Examples

posted on 2023-06-21 22:37:19 - ChatGPT Tutorials


Use Cases

Chat GPT Key Use Cases

posted on 2023-06-21 21:03:17 - ChatGPT Tutorials


Prompt Frameworks

Prompt Frameworks

posted on 2023-06-21 19:33:06 - ChatGPT Tutorials