SQL SELECT query exercies

Objective: To practice the subqueries.

[This exercise is based on the HR database. Before you begin, download the file and get familiar with the table structure.]

  1. Write a query to display the lastname, and hiredate of any employee in the department as the employee "Zlotkey". Exclude "Zlotkey".
  2. Create a query to display the employee numbers and lastnames of all employees who earn more than the average salary. Sort the result in ascending order of salary.
  3. Write a query that displays the employee number and lastname of all employees who work in a department with any employee whose lastname contains a "u".
  4. Display the lastname, department number, and job id of all employees whose department location id is 1700.
  5. Display the lastname and salary of every employee who reports to "King".
  6. Display the department number, lastname, and job id for every employee in the "Executive" department.
  7. Display the employee number, lastname, and salary of all employees who earn more than the average salary and who work in a department with any employee with a "u" in their lastname.