Between operator TSQL Tutorial

Between operator:

Cities table:

CITY_IDNAMESTATE
1New YorkNew York
2Los AngelesCalifornia
3ChicagoIllinois
4San AntonioTexas
5San DiegoCalifornia

Between Example 1:

Find the cities with id between 2 and 4.
SELECT * FROM cities WHERE city_id BETWEEN 2 AND 4;

Between Result:

CITY_IDNAMESTATE
2Los AngelesCalifornia
3ChicagoIllinois
4San AntonioTexas

Insurance table:

IDTYPESTART_DATEEND_DATE
2Life2012-01-212052-01-20
3Health2013-01-262018-01-25
4Vehicle2010-01-232012-01-22
5Vehicle2008-06-212016-06-20
6Health2009-03-072030-03-06

Between Example 2:

Find the insurance policies underwritten between '01-JAN-2010' and '31-JAN-2013'.
SELECT * FROM insurance WHERE start_date BETWEEN '2010-01-01' AND '2013-01-31';

Between Result:

IDTYPESTART_DATEEND_DATE
2Life2012-01-212052-01-20
3Health2013-01-262018-01-25
4Vehicle2010-01-232012-01-22