You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
500 B
SQL

/*Write a query in SQL to display the the details of those departments which max salary is 7000 or above for those employees
who already done one or more jobs.
*/
SELECT *
FROM departments
WHERE department_id IN
(SELECT department_id
FROM employees
WHERE employee_id IN
(SELECT employee_id
FROM job_history)
GROUP BY department_id
HAVING MAX(salary) >=7000);