What is BETWEEN Logical Operator in SQL Server - SQL Server / TSQL Tutorial Part 124

What is BETWEEN Logical Operator : 

BETWEEN returns TRUE if the operand is within range. BETWEEN logical operator is used when we want to return the row if operand is within range.


Let's say that we have dbo.Cutomer table and one of the column is Age. If we would like to return all the records from dbo.Customer table where age between 33 and 60. What Logical Operator we can use?


We can use BETWEEN logical operator to test ranges. If True then row will be returned otherwise not.

Create table dbo.Customer
 (Id int,
  FName VARCHAR(50),
  LName VARCHAR(50),
  CountryShortName CHAR(2),
  Age tinyint)
insert into dbo.Customer
Values (

BETWEEN returns TRUE if the value of test_expression is greater than or equal to the value of begin_expression and less than or equal to the value of end_expression.

We can use below query to return all the rows if age is between 33 and 60.

Select * From dbo.Customer
where Age between 33 and 60

How to use BETWEEN Logical Operator to check range and return rows - SQL Server / TSQL Tutorial

We can also use NOT BETWEEN that will retrun TRUE if the value of test expression is less than the value of begin expression or greater than the value of end expression.
If we want to return all the records where Age is less than 33 or greater than 60 we can use NOT BETWEEN as shown below.

Select * From dbo.Customer
where Age NOT between 33 and 60
How to use NOT BETWEEN in SQL Server Query - SQL Server / TSQL Tutorial

Video Demo : How to use Between and Not Between in SQL Server


  1. Do you need Personal Finance?
    Business Cash Finance?
    Unsecured Finance
    Fast and Simple Finance?
    Quick Application Process?
    Finance. Services Rendered include,
    *Debt Consolidation Finance
    *Business Finance Services
    *Personal Finance services Help
    contact us today and get the best lending service
    personal cash business cash just email us below
    Contact Us: financialserviceoffer876@gmail.com
    call or add us on what's app +918929509036

  2. I am so delighted I found your weblog, I really found you by accident,
    And would just like to say thank you for a fantastic post and a all round entertaining blog (I also love the theme/design), HOW TO EASILY GET A FAKE DRIVERS LICENSE THAT WORKS FROM THE DMV I don't have time to go through it all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the excellent job.

    Y’all don’t forget to join this DMV EXPERTS TELEGRAM GROUP for more information about new drivers license and updated materials being used along the production process of the DL . You can also take advantage to learn and meet many Experts who will guide you on numerous techniques for anyone who love hacking and don’t know how to go about it .