SQL Built in Functions

 

👉SQL Server Math/Numeric Functions👈


Function

Description

ABS

Returns the absolute value of a number

ACOS

Returns the arc cosine of a number

ASIN

Returns the arc sine of a number

ATAN

Returns the arc tangent of a number

ATN2

Returns the arc tangent of two numbers

AVG

Returns the average value of an expression

CEILING

Returns the smallest integer value that is >= a number

COUNT

Returns the number of records returned by a select query

COS

Returns the cosine of a number

COT

Returns the cotangent of a number

DEGREES

Converts a value in radians to degrees

EXP

Returns e raised to the power of a specified number

FLOOR

Returns the largest integer value that is <= to a number

LOG

Returns the natural logarithm of a number, or the logarithm of a number to a specified base

LOG10

Returns the natural logarithm of a number to base 10

MAX

Returns the maximum value in a set of values

MIN

Returns the minimum value in a set of values

PI

Returns the value of PI

POWER

Returns the value of a number raised to the power of another number

RADIANS

Converts a degree value into radians

RAND

Returns a random number

ROUND

Rounds a number to a specified number of decimal places

SIGN

Returns the sign of a number

SIN

Returns the sine of a number

SQRT

Returns the square root of a number

SQUARE

Returns the square of a number

SUM

Calculates the sum of a set of values

TAN

Returns the tangent of a number




👉Example of some important SQL👈


For more exploration we are creating a Table 

Create table Math_function(num1 int, num2 int)
insert into Math_function 
values(10,20),
(25,30),
(35,40),
(45,50),
(55,60),
(65,70);

Select * from Math_function

--1.AVGERAGE

SELECT AVG(num1) FROM Math_function;

--2.COUNT

SELECT COUNT(num1) FROM Math_function;

--3.ADD TWO TABLE WITH SUM FUNCTION

SELECT Sum(num1+num2) FROM Math_function;

--4.FLOOR

SELECT FLOOR(num1) FROM Math_function;

FOR MORE INFORMATION CONTACT US.....!!!!                                 

0 Comments