1789. Primary Department for Each Employee¶ SQL 1 2 3 4 5 6 7 8 9 10 11 12SELECT employee_id, department_id FROM Employee WHERE primary_flag = 'Y' UNION DISTINCT SELECT employee_id, department_id FROM Employee GROUP BY 1 HAVING COUNT(*) = 1;