10 lines
347 B
MySQL
10 lines
347 B
MySQL
|
/*Write a query which is looking for the names of all employees whose salary is greater than 50% of their department’s
|
|||
|
total salary bill.
|
|||
|
*/
|
|||
|
|
|||
|
SELECT e1.first_name, e1.last_name
|
|||
|
FROM employees e1
|
|||
|
WHERE salary >
|
|||
|
( SELECT (SUM(salary))*.5
|
|||
|
FROM employees e2
|
|||
|
WHERE e1.department_id=e2.department_id);
|