SQL Numeric Functions Examples

A-Z of Mircrosoft SQL

Main Page Introduction SSMS Acronym's used in SQL SQL Commands SQL Functions SQL Store Procedures SQL Views SQL Triggers SQL Operators SQL - Adding Comments SQL Alias SQL Joins SQL - Building Basic Scripts SQL - Execution Plan Questions or Suggestions
H1B Jobs- Visual Reports

SQL Examples

Arithmetic Operators Comparision Operators Logical Operators Bitwise Operators String Functions Date Functions Numeric Functions


Examples on how we use these Functions

Here are some Screenshots with real time results of how you can use the Functions. If used in correct way , they can help is powerful SQL transformations , data mining , data analysis.

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL AVG() Function

AVG() function can be used to return the Average for a set of values in that field.

 SQL AVG() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL CEILING() Function

CEILING( function can be used to return a values which is lesser or equal to the value over which this funtion is used.

 SQL CEILING() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL COUNT() Function

COUNT() function can be used to return the total number of records for that field.

If there are repeating values in a field and we need to find distinct count, we can write Count(distinct BusinessEntityID).

SQL COUNT() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL SUM() Function

SUM() function can be used to return the sum of all values in a certain column.

SQL SUM() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SIN() Function

SIN() function can be used to return the SINE value.

SQL SIN() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL COS() Function

COS() function can be used to return the cosine value.

SQL COS() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL COT() Function

COT() function can be used to return the COT value.

SQL COT() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL TAN() Function

TAN() function can be used to return the TAN value.

SQL TAN() Function

We will use a certain value for this function

SQL DEGREES() Function

DEGREES() function can be used to converts a value in radians to degrees..

SQL DEGREES() Function

We will use a certain value for this function

SQL EXP() Function

EXP() function can be used to return EXPONENTIAL value raised.

SQL EXP() Function

We will use a certain value for this function

SQL FLOOR() Function

FLOOR() function can be used to return the largest integer value that is equal to or less.

SQL FLOOR() Function

We will use a certain value for this function

SQL LOG() Function

LOG() function can be used to return natural logarithm of 2.

SQL LOG() Function

We will use a certain value for this function

SQL LOG10() Function

LOG10() function can be used to return the base-10 logarithm of 2.

SQL LOG10() Function

We will use a certain value for this function

SQL ABS() Function

ABS() function can be used to return the absolute value of a number.

SQL ABS() Function

We will use a certain value for this function

SQL ACOS() Function

ACOS() function can be used to return the arc cosine of a number.

SQL ACOS() Function

We will use a certain value for this function

SQL ATAN() Function

ATAN() function can be used to return the arc tangent of a number.

SQL ATAN() Function

We will use a certain value for this function

SQL ASIN() Function

ASIN() function can be used to return the arc sine of a number.

SQL ASIN() Function

We will use a certain value for this function

SQL ATN2() Function

ATN2() function can be used to return the arc tangent of two values.

SQL ATN2() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL MAX() Function

MAX() function can be used to return the maximum for a set of values, they can be grouped by another field as well.

SQL MAX() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL MIN() Function

MIN() function can be used to return the minimum for a set of values, they can be grouped by another field as well.

SQL MIN() Function

SQL PI() Function

PI() function can be used to return the value of PI.

SQL PI() Function

We will use a certain value for this function

SQL POWER() Function

POWER() function can be used to return the value of a number raised to the power of another number..

SQL POWER() Function

We will use a certain value for this function

SQL RADIANS() Function

RADIANS() function can be used converts a degree value into radians..

SQL RADIANS() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL RAND() Function

RAND() function can be used return a random decimal number, its used in cases where we need to de identify data and give some random values are outputs.

SQL RAND() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL ROUND() Function

ROUND() function can be used to rounds a number to a specified number of decimal places.

SQL ROUND() Function

We will use a certain value for this function

SQL SIGN() Function

SIGN() function can be used to returns the sign of a number

This function will return one of the following:

If number > 0, it returns 1

If number = 0, it returns 0

If number < 0, it returns -1

SQL SIGN() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL ROSQUAREUND() Function

SQUARE() function can be used to return the SQUARE of a value.

SQL SQUARE() Function

We will use [AdventureWorks2012].[Person].[Person] table for this Function

SQL SQRT() Function

SQRT() function can be used to return the SQUARE ROOT of a value.

SQL SQRT() Function