SELECT emp_no, dept_no, COUNT(from_date) AS no_of_contracts FROM dept_emp WHERE from_date>'2000-01-01' GROUP BY emp_no HAVING COUNT(from_date)>1 ORDER BY emp_no;
The above query can also be used to get the actual number of contracts signed by the employees
which are greater than 1.
Is this correct?
Thanks for reaching out.
Yes, this is correct! In this query, you are referring still to the same single table, which is dept_emp, therefore the aggregate function only contributes to obtaining a richer output.
Thank you for sharing it with the Community!