0
What is the difference from IN and between?
7 Answers
+ 6
For between you can specify the range of values. But for IN you have to enter the values which you want.
1)You want the values from 1 to 10
Between 1 and 10
IN (1,2,3,4,5, 6,7,8,9,10)
2) you want values 4 and 6
In this case you can't use between
IN (4,6)
+ 4
You have to define your all the values in IN operators, but in BETWEEN you have to define only start and end point.
IN operators is mostly used for making sub -query in which your values are fetched from another query.
Example :
SELECT * FROM students
WHERE class_teacher IN
(SELECT * FROM teacher WHERE age BETWEEN 35 AND 55)
+ 1
in is to check for a condition where d given attribute's value is in the given set of values
WHERE ID IN(1,5,6)
it is true if id=1 or 5 or 6
BETWEEN is used to check if given attribute's value is in between a specified range
WHERE ID BETWEEN 5 AND 10
ie., ID>5 AND ID<10
0
between means...
if u want to select the range.like( 1 to 10) or(A to z)
The IN operater returns the value in the column u entered
0
1)Between A and B is used if you want to have the values between A and B (Note: Both A and B inclusive)
Between 1 and 10
2)IN is used if you want check whether the value is in the given domain or not
IN (a,b,c,d,e)
0
The between operator selects a range:
WHERE age BETWEEN 20 AND 25;
The IN operator selects values:
WHERE gender IN ('male', 'female');
0
simply think.... between is used to select things in between two no. and in is used to select things from your choice u have righten in braces..