Lab#3 - SQL Queries – (Subqueries) - Exercises
Lab#3 - SQL Queries – (Subqueries) - Exercises
LAB 3
EXERCISES
Page 1 of 3
1. Write a query to find the name (first_name, last_name) and the salary of the employees who have
a higher salary than the employee whose last_name='Bull'.
2. Select the name (first_name, last_name) of all employees who works in the IT department
(department_name is IT).
3. Select the name (first_name, last_name) of the employees who are managers (employee_ID value
is one of the manager_ID values).
4. Select the name (first_name, last_name), and salary of the employees whose salary is greater than
the average salary.
5. Select the name (first_name, last_name), and salary of the employees whose salary is equal to the
minimum salary for their job grade.
6. Select the name (first_name, last_name), and salary of the employees who earns more than the
average salary and works in any of the IT departments (the name of the department should start
by “IT”).
7. Select the name (first_name, last_name), and salary of the employees who earns more than the
earning of Mr. Bell (employees last_name = “Bell”) and sort the results in ascending order
according to the salary.
8. Select all records of the employees who earn the same salary as the minimum salary of the
employees.
9. Select all the records of the employees whose salary is greater than the average salary of all
departments.
10. Select the name (first_name, last_name) and salary of the employees who earn a salary that is
higher than the salary of all the Shipping Clerk (job_id = 'SH_CLERK'). Sort the results of the
salary of the lowest to highest.
11. Write a query to display the name (first name and last name) for those employees who get more
salary than the employee whose id is 163.
12. Write a query to display the name (first name and last name), salary, department id, job id for
those employees who work in the same designation as the employee whose id is 169.
13. Write a query to display the name (first name and last name), salary, department id for those
employees who earn such amount of salary which is the smallest salary of any of the departments.
14. Write a query to display the name (first name and last name), salary, department id for those
employees who earn such amount of salary which is the smallest salary of any of the departments.
15. Write a query to display the department id, name (first name and last name), job and department
name for all employees in the Finance department.
16. Display all the information of an employee whose id is any of the number 134, 159 and 183.
17. Write a query to display all the information of the employees whose salary is within the range
1000 and 3000.
Page 2 of 3
18. Write a query to display all the information of the employees whose salary is within the range of
smallest salary and 250.
19. Write a query to display all the information of the employees who does not work in those
departments where some employees work whose manager id within the range 100 and 200.
20. Write a query to display the employee name (first name and last name) and hire_date for all
employees in the same department as Clara. Exclude Clara.
21. Write a query to display the employee ID and name (first name and last name) for all employees
who work in a department with any employee whose name contains the letter ‘T’.
22. Write a query to display the employee ID, name (first name and last name), and salary for all
employees who earn more than the average salary and who work in a department with any
employee with a J in their name.
Page 3 of 3