Monday, 11 February 2013

How to use BETWEEN Operator in SQL Server

SQL Server BETWEEN Operator
The BETWEEN operator selects a range of data between two values. The values can be numbers, text, or dates. The BETWEEN operator will be used in combination of Where Clause.

Syntax:
SELECT column_name(s) FROM table_name WHERE column_name
BETWEEN Value1 AND Value2

Example :

Let us suppose we have and EMP Table as follows :


Criteria :
If we want to select the Employees whose salary between 30000 and 50000 , use the below query.

Select *from EMP E WHERE E.Salary BETWEEN 30000 and 50000

Result :

Thanks, TAMATAM

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your open Feedback only related to this Blog Posts. Please note that I cannot respond to the Anonymous Comments.

Subscribe to Blog Posts by Email

ExcelKingdom-Popular Posts