Monday, February 11, 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 genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog