+ 1

Can we give 2 or more conditions by using where?

10th May 2016, 2:12 AM
Rajul shah
Rajul shah - avatar
13 ответов
+ 3
Yes you can! SELECT * FROM users WHERE Id > 100 AND Name = 'James'
20th Jun 2016, 1:40 PM
James Flanders
+ 3
Yes for example. select * from Nepal where location = 'Katmandu' and salary > 10000 and last_name = 'Ghimire' ;
20th Jun 2016, 6:28 PM
Suman Ghimire
Suman Ghimire - avatar
+ 3
Absolutely! You just have to join your conditions using the AND keyword if you want them all to be true or the OR keyword if just one of them needs to be true. Examples: SELECT * FROM students WHERE state='New York' AND age>16 this will give a list of all students older than 16 that are from New York SELECT * FROM students WHERE state='New York' OR age>16 This will give a list of all students either from New York or older than 16.
22nd Jun 2016, 6:02 PM
Andrew Fawbush
Andrew Fawbush - avatar
+ 3
You can use AND , OR operators between the conditions according to your requirement. SELECT * FROM TableName WHERE CONDITION1 AND CONDITION2 SELECT * FROM TableName WHERE CONDITION1 OR CONDITION2 Likewise you can join two or more conditions. You can use AND and OR at the same time. SELECT * FROM TableName WHERE (CONDITION1 or CONDITION2) and CONDITION3
26th Jun 2016, 9:13 AM
Sai Kartheek
Sai Kartheek - avatar
+ 3
Yes , you can use as many time as you want but you need to use boolean operators like AND , OR , NOT
13th Jul 2016, 9:26 AM
Suryaprakash Tiwari
Suryaprakash Tiwari - avatar
+ 1
yes,why not SELECT * FROM TableName WHERE ColumnName1=Value1 AND(also you can use OR) ColumnName2=Value2 AND(OR)...
21st Jun 2016, 12:41 AM
Hossein Tavasolnia
Hossein Tavasolnia - avatar
+ 1
yes.. using connectives AND or OR syntax: select column_names_list from table_names where condition1 AND (/OR) condition2
3rd Jul 2016, 9:47 AM
Mrunal Selokar
Mrunal Selokar - avatar
0
select ename from emp where ename= 'SMITH' and ename='KING'; this is a proper example to use 2 conditions
23rd Jun 2016, 12:46 AM
Alfahad Mahimi
Alfahad Mahimi - avatar
0
yes
16th Jul 2016, 8:19 PM
Dev_140897
Dev_140897 - avatar
0
yes
15th Aug 2016, 6:56 PM
gopi chand komma
gopi chand komma - avatar
- 3
select name,id from emp where id =101 or name=any other row name;
21st Jun 2016, 10:36 AM
Abhishek singh
Abhishek singh - avatar
- 3
how can use joint table
21st Jun 2016, 6:14 PM
lalit dhange
lalit dhange - avatar
- 6
no
21st Jun 2016, 5:33 PM
samyuktha anugula
samyuktha anugula - avatar