Advanced SQL Exercise – Subqueries Exercise 02: This exercise covers the following topics: •
Creating comparisons in a multiple-column subquery using pairwise or nonpairwise
Instructions: • • •
Write a query for each of the following situations/problems. Use the EMPLOYEES table as your basis for the queries. To be submitted today, class time.
1. Write a query to display the last name, department number, and salary of any employees whose department number and salary both match the department number and salary of any employees who earns a commission. 2. Create a query to display the last name, hire date, and salary for all employees who have the same salary and commission as Kochhar. Do not display Kochhar in the result set.
3. Create a query to display all employees who are managed by the same manager as the employees with EMPLOYEE_ID 128 or 129 or whose job_id are the same as with the employees with EMPLOYEE_ID 128 OR 129. 4. Display the last name, department name, and salary of any employee whose salary and commission match the salary and commission of any employee located in location ID 1700.