SQL Subquery Exercises: Display all the information of an employee whose salary and reporting person id is 3000 and 121 respectively
SQL SUBQUERY: Exercise-7 with Solution
From the following table, write a SQL query to find the employee whose salary is 3000 and reporting person’s ID is 121. Return all fields.
Sample table: employees
SELECT * FROM employees WHERE (salary,manager_id)= (SELECT 3000,121);
employee_id first_name last_name email phone_number hire_date job_id salary commission_pct manager_id department_id 187 Anthony Cabrio ACABRIO 650.509.4876 2007-02-07 SH_CLERK 3000.00 0.00 121 50
Contribute your code and comments through Disqus.
Previous: From the following tables, write a SQL query to find all those employees who work in the Finance department. Return department ID, name (first), job ID and department name.
Next: From the following table, write a SQL query to find those employees whose ID matches any of the number 134, 159 and 183. Return all the fields.
Test your Programming skills with w3resource's quiz.
What is the difficulty level of this exercise?
SQL: Tips of the Day
"where 1=1" statement?
It's usually when folks build up SQL statements.
When you add and value = "Toyota" you don't have to worry about whether there is a condition before or just WHERE.
- Exercises: Weekly Top 12 Most Popular Topics
- Pandas DataFrame: Exercises, Practice, Solution
- Conversion Tools
- SQL Exercises, Practice, Solution - SUBQUERIES
- C Programming Exercises, Practice, Solution : For Loop
- Python Exercises, Practice, Solution
- Python Data Type: List - Exercises, Practice, Solution
- C++ Basic: Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - exercises on Employee Database
- SQL Exercises, Practice, Solution - exercises on Movie Database
- SQL Exercises, Practice, Solution - exercises on Soccer Database
- C Programming Exercises, Practice, Solution : Recursion