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.]
- Write a query to display the lastname, and hiredate of any employee in the department as the employee "Zlotkey". Exclude "Zlotkey".
- 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.
- 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".
- Display the lastname, department number, and job id of all employees whose department location id is 1700.
- Display the lastname and salary of every employee who reports to "King".
- Display the department number, lastname, and job id for every employee in the "Executive" department.
- 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.
Structured Query Language