programming-examples/sql/SubqueriesHRDatabase/Write a query in SQL to display the first and last name, salary, and department ID for those employees whose salary is equal to the salary.sql

10 lines
459 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*Write a query in SQL to display the first and last name, salary, and department ID for those employees whose salary is equal
to the salary of the employee who works in that department which ID is 40.
*/
SELECT first_name, last_name, salary, department_id
FROM employees
WHERE salary IN (
SELECT salary
FROM employees
WHERE department_id = 40);