Substring() function in SQL Server

Substring():- This function is used to return the specified number (third argument “len”) of characters from a given string(first argument) from the start position as specified as the second argument. Syntax:-    Select  SUBSTRING ( expression ,start , length ) For example,        Select  SUBSTRING ( ‘kingmaker’ ,1 , 4 ) Result     king

Continue Reading

Max() function in SQL Server

Max():- This function gives the maximum value of the selected column Syntax:- Select Max (col1) from table_name In this article, we are going to use the following table for the examples:- CREATE TABLE [dbo]. [Employee]( [Empid] [Int] IDENTITY (1, 1) NOT NULL Primary key, [EmpNumber] [nvarchar](50) NOT NULL, [EmpFirstName] [nvarchar](150) NOT NULL, [EmpLAStName] [nvarchar](150) NULL, […]

Continue Reading

SUM() function in SQL Server

Sum():- This function is used to get the sum of values of the specified numeric column.  Syntax:-  Select Sum (column_name) from tablename Example:- In this article, we are going to use the following table for the examples:- CREATE TABLE [dbo]. [Employee]([Empid] [Int] IDENTITY (1, 1) NOT NULL Primary key,[EmpNumber] [nvarchar](50) NOT NULL,[EmpFirstName] [nvarchar](150) NOT NULL,[EmpLAStName] […]

Continue Reading

Round() function in SQL Server

Round():-This function is used to round a numeric field to the number of decimals specified. Syntax:-     ROUND ( numeric_expression , length [ ,function ] numeric_expression :-Expression of the exact numeric or approximate numeric data type category, except for the bit data type. length:- Optional.Must be an expression of type tinyint, smallint, or int. When […]

Continue Reading

Like() function in SQL Server

Like:- This operator is used in a WHERE clause to search for a specific pattern in the values of the column. In this article, we are going to use the following table for the examples:- CREATE TABLE [dbo]. [Employee]([Empid] [Int] IDENTITY (1, 1) NOT NULL Primary key,[EmpNumber] [nvarchar](50) NOT NULL,[EmpFirstName] [nvarchar](150) NOT NULL,[EmpLAStName] [nvarchar](150) NULL,[EmpEmail] […]

Continue Reading