OR Logical Operator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

OR Logical Operator

if you want to find the customers who live either in New York or Chicago, the query would look like this SELECT * FROM customers WHERE City = 'New York' OR City = 'Chicago'; Can I also use the AND Operator Since it Satisfies all The Given Conditions

21st Jun 2018, 2:43 PM
Akande Seun
Akande Seun - avatar
5 Answers
+ 5
No because that would not look for customers that live in New York or Chicago it would look for customers who live in Chicago AND New York.
21st Jun 2018, 7:35 PM
George Ryan
George Ryan - avatar
+ 5
AND is used whenever both the condition or choice are right...means if AND used in between Chicago and New York then it's means person live in both places
24th Jun 2018, 12:06 PM
Ashish Bhadauria
Ashish Bhadauria - avatar
0
both conditions must be met when AND is used to return results
9th Sep 2018, 9:37 PM
amy
0
no beacuse it will give you the list of customer that lives in both city i.e. New York and Chicago
10th Sep 2018, 6:21 AM
Deep patel
Deep patel - avatar
0
You can use in clause , select * from customers where city in ('New York', 'Chicago') ;
18th Jan 2019, 7:04 AM
madhurendra pandey
madhurendra pandey - avatar