In order to fetch values within a given range we can make use of BETWEEN operators.

SYNTAX

85.png

Where,

  • BETWEEN                            : keyword used checks records that fall between a certain range .

  • Table_name                        : The name of the table from where you want to fetch the data

  • Column1Name, Column2Name         : The name of the columns of the table which you want to uniquely fetch.

EXAMPLE

Let us consider a demo database with table name Persons.

86.png
87.png
 

Figure 26.1. Select * from Persons;

 

Figure 26.2. BETWEEN QUERY & OUTPUT

PRACTICE YOURSELF 

88.png
 

Want More SQL Deep Dives