SQL AND & OR Operators

SHOW Table:

select * from employeeinfo;

name age address salary
Komal 25 Mumbai 5000
Ramesh 35 Delhi 4500
Kaushik 31 Indore 10000
Hardik 22 Hyderabad 8500
Aishwarya 28 Bangalore 6500
Akshaya 29 Delhi 5000

AND Operator:

SELECT * from employeeinfo where name=’Ramesh’ AND age=’35’;

name age address salary
Ramesh 35 Delhi 4500

OR Operator:

SELECT * from employeeinfo where name=’Ramesh’ OR name =’Komal’;

name age address salary
Komal 25 Mumbai 5000
Ramesh 35 Delhi 4500

Both AND & OR Operator:

select * from employeeinfo where name=’Ramesh’ AND (age=’35’ OR age=’25’);

name age address salary
Ramesh 35 Delhi 4500

Leave a Reply

Your email address will not be published. Required fields are marked *