Between Clause
With between, the data can be selected, where for a given attribute one can define the range for its values to be given as output.
The output contains both maximum and minimum values of range.
Consider the ‘FACULTY’ relation.
FNo D-No D-Name FName Qual
22 21 CSE Alex Ph.D.
24 22 IT Ria MTech
25 22 IT Ben MTech
27 23 ECE Becca MTech
30 23 ECE Alice MTech
33 24 ME Lex Ph.D.
35 24 ME Maggie Ph.D.
37 25 EEE Max MTech
39 25 EEE Bec MTech
————————————————————-
Example-1 :Find all the tuples from the ‘faculty’ relation, where the
D-No is greater than or equal to 22 and less than or equal to 24.
Select *
From Faculty
Where DNo>=22 and DNo<=24 ;
This can be written as :
Select *
From faculty
Where DNo between 22 and 24 ;
Output :
R4 : FACULTY
————————————————
FNo FName DNo Qual
———————————————–
24 Ria 22 MTech
25 Ben 22 MTech
27 Becca 23 MTech
30 Alice 23 MTech
33 Lex 24 P.hD
35 Maggie 24 P.hD
———————————————-
Here, the output contains six tuples.
Between Clause