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 Feedback/Comments/Query.

Subscribe to Blog Posts by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts