3. Find the employees who are working in more than 2 departments. Print their employee number, first name, last_name and the number of departments they work in. SELECT EMPLOYEE_ID,FIRST_NAME,LAST_NAME,COUNT(DEPARTMENT_ID) FROM employeesHAVING COUNT(DEPARTMENT_ID) > 2Group by 1,2,3
3. Find the employees who are working in more than 2 departments. Print their employee number, first name, last_name and the number of departments they work in.
SELECT EMPLOYEE_ID,
FIRST_NAME,
LAST_NAME,
COUNT(DEPARTMENT_ID)
FROM employees
HAVING COUNT(DEPARTMENT_ID) > 2
Group by 1,2,3
Comments
Post a Comment