Web Analytics Made Easy - Statcounter

RIGHT() function in SQL Server

blank

SQL Server – RIGHT () function Right():- This function returns the specified number of characters from the Right part of the given character string. Syntax:- Select RIGHT ( character_expression , integer_expression ) For example, the below query will return two characters from the last. Select RIGHT(‘Vivek’,2) Result ek

LEFT() function in SQL Server

blank

LEFT() function in SQL Server Left() Function  This function returns the specified number of characters from the left part of the given character string. Syntax Select LEFT ( character_expression , integer_expression )For example, the below query will return two characters from the beginning Select LEFT  (‘Vivek’,2) Result Vi

Between function in SQL Server

blank

Between function in SQL Server This function is used to select the values within a specified range. These values can be of Int type or Date data type or Text data type. Syntax:- SELECT column_name(s) FROM table_name WHERE column_name BETWEEN value1 AND value2 In this article, we are going to use the following table for … Read more

IN clause in SQL Server

blank

With IN clause, we can specify multiple values in a WHERE clause. For example, in case of “IN”, one can use the subquery to get the multiple values in the IN clause or we can have predefined values. In this article, we are going to use the following table for some examples:-CREATE TABLE [dbo]. [Employee]([Empid] … Read more

UPPER() function in SQL Server

blank

UPPER():- This function is used to convert the value of a column to upper case.  Syntax:    SELECT UPPER(string) OR Select UPPER(Column name) from tablename For example,   SELECT UPPER(‘Vivek’) Result:    VIVEK

AVG() function in SQL Server

blank

Avg():- This function is used to get the average value of a numeric column Syntax:-       SELECT AVG(column_name) FROM table_name In this article, we are going to use the following table for some examples:- CREATE TABLE [dbo]. [Employee]( [Empid] [Int] IDENTITY (1, 1) NOT NULL Primary key, [EmpNumber] [nvarchar](50) NOT NULL, [EmpFirstName] [nvarchar](150) NOT NULL, … Read more

LOWER() function in SQL Server

blank

LOWER():- This function is used to convert the value of a column to lower case  Syntax:-  Select LOWER (string)    or    SELECT LOWER(column_name) FROM table_name For example, SELECT LOWER(‘Vivek Johari’) Result:- vivek johari

LEN() function in SQL Server

blank

LEN():- This function is used to get the length of the given string value.   Syntax:-     Select len (stringvalue)   For example,     Select len(‘Vivek Johari’)    Result:-    12

Substring() function in SQL Server

blank

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

LTRIM() function in SQL Server

blank

LTRIM ():- This function is used to get the string after the removal of leading blank spaces. Syntax:- LTRIM ( character_expression ) For example:- Select LTRIM  (‘  Vivek Johari’) Result:- Vivek Johari (without blank spaces on left side)