/*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); 