programming-examples/sql/SubqueriesHRDatabase/Write a query in SQL to display the first and last name, salary, and department ID for those employees who earn less than the average salary, and also work at the department.sql
2019-11-18 14:05:53 +01:00

13 lines
593 B
SQL

/*Write a query in SQL to display the first and last name, salary, and department ID for those employees who earn less than
the average salary, and also work at the department where the employee Laura is working as a first name holder.
*/
SELECT first_name, last_name, salary, department_id
FROM employees
WHERE salary <
(SELECT AVG(salary)
FROM employees )
AND department_id =
(SELECT department_id
FROM employees
WHERE first_name = 'Laura');