+ 1

In and Or can be nested? Is this code is valid???

select* from employee where city in((' Bengalur' , 'Anantapur','Hindupur') or ('Vizag', ' Vijayawada' , ' Araku'));

22nd Apr 2018, 8:50 AM
DN HAMSAVENI
DN HAMSAVENI - avatar
3 odpowiedzi
+ 7
Either this: SELECT * FROM employee WHERE city IN(' Bengalur' , 'Anantapur', 'Hindupur') OR city IN ('Vizag', ' Vijayawada' , ' Araku'); Or this: SELECT * FROM employee WHERE city IN(' Bengalur' , 'Anantapur', 'Hindupur', 'Vizag', ' Vijayawada' , ' Araku');
22nd Apr 2018, 9:09 AM
Ipang
+ 3
except you are searching for parameters with two different identities like salary and country. E.g SELECT * from employee WHERE salary IN('500', '2000', '50000') OR country IN ('Nigeria', 'Indonesia', 'Britain');
22nd Apr 2018, 12:42 PM
Laurence Igbokwe
Laurence Igbokwe - avatar
+ 2
DN HAMSAVENI its unnecessary because u could have put it all in the IN bracket and youd get your answer just fine
22nd Apr 2018, 12:36 PM
Laurence Igbokwe
Laurence Igbokwe - avatar