what is difference between AND and BETWEEN | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

what is difference between AND and BETWEEN

21st Aug 2016, 8:37 AM
vicky manhotra
vicky manhotra - avatar
7 Answers
+ 10
AND is used whenever we need to satisfy all the constraints specified in our query whereas BETWEEN is used whenever we need to retrieve data from a given set(range of values).I hope this answers your question.
30th Aug 2016, 4:23 AM
Harshika Vakulabharanam
Harshika Vakulabharanam - avatar
+ 7
You can think that BETWEEN shall be used just if you have a lower and upper limit for the selection and those limits are of the same type. Instead, if you have two conditions, not necessarily of the same type (may be a character and a numeric) you need to use AND.
21st Aug 2016, 3:14 PM
Óscar Villa
Óscar Villa - avatar
+ 6
Ex. Select name from students where lastname ='abc' and age=21; now here both conditions shall be satisfied for expecting an outcome. But if we say select name from students where age between 17 and 21; here it checks just age parameter.
21st Aug 2016, 1:03 PM
sanchit
sanchit - avatar
+ 1
i'll give you an example .... if you want to select a customer whose age between 20 and 30 ..simply you can use AND and write ~....BETWEEN 20 AND 30 ..but if you need to select a customer whose age btween 20 and 30 and alse live in USA you must use AND and write ~... WHOSE Aage>=20 AND age<=40 AND city='USA'
22nd Aug 2016, 6:05 PM
Sara_
+ 1
AND is used when you need more then 1 specific and BETWEEN is used when you want to do something with data that is between for example SELECT customers FROM mytable WHERE customer_id=5 AND cart_value BETWEEN 200 AND 2000; first AND is used to ensure that selection will select next statment (BETWEEN), AND used after between ensures that price range is 200-2000
17th Feb 2017, 6:13 PM
Nemanja Jovanović
Nemanja Jovanović - avatar
+ 1
AND used to addition for something between mains the thing which was in the two things
21st Feb 2017, 4:11 PM
Mohamed Aslan
Mohamed Aslan - avatar
0
And means 2 conditions to be fulfilled, between gives us a range.
21st Aug 2016, 1:01 PM
sanchit
sanchit - avatar