Write a query which shows which empno has been to the most courses. List the empno and the number of courses that person has been on. There may be multiple employees with the biggest count.
You should make use of HAVING. For instance, to show the depno and the number of employees in that depno for only the biggest department you could do:
SELECT depno,count(*)
from employee
group by depno
having count(*) = (
select max(count(*))
from employee
group by depno
);
|