Tuesday, June 15, 2010

Database Testing - SQL- Where Condition Examples

Where Conditions:

8. List the details about "SMITH"

Select * from employee where last_name='SMITH';

9. List out the employees who are working in department 20

Select * from employee where department_id=20

10. List out the employees who are earning salary between 3000 and 4500

Select * from employee where salary between 3000 and 4500

11. List out the employees who are working in department 10 or 20

Select * from employee where department_id in (10,20)

12. Find out the employees who are not working in department 10 or 30

Select last_name, salary, commission, department_id from employee where department_id not in (10,30)

13. List out the employees whose name starts with "S"

Select * from employee where last_name like 'S%'

14. List out the employees whose name start with "S" and end with "H"

Select * from employee where last_name like 'S%H'

15. List out the employees whose name length is 4 and start with "S"

Select * from employee where last_name like 'S___'

16. List out the employees who are working in department 10 and draw the salaries more than 3500

Select * from employee where department_id=10 and salary>3500

17. list out the employees who are not receiving commission.

Select * from employee where commission is Null

No comments:

Post a Comment