Possible Clarification for Use of COUNT in WHERE vs HAVING - Exercises 2
Dear 365 Team,
I was a bit confused in this exercise, like some of the other learners, why we needed to apply the HAVING COUNT(emp_no) (or any other column in the dept_emp).
In my mind, I was thinking, wouldn't it be the same if it is a yearly contract, so employees signed on every year would also apply to the field specified?
(As in, you can just use
WHERE from_date > '2000-01-01';)
Afterwards, I only realized that it means that the employee signed 2 separate contracts, hence why HAVING COUNT() is needed.
You can see the proof below, in which selecting one of the emp_no of the assignment solution output shows that emp_no 11609 signed the contract twice, probably due to change in department.
Suggestion: Should the Assignment prompt specify "...individuals who have signed the contract more than once after 1st of January 2000"?
Or perhaps provide a hint to say that it's referring to rehiring or changing departments, because I spent more than 20 minutes trying to think about why HAVING COUNT() was needed, and the QA section was not helping me wrap my head around what the prompt means.
Thank you very much!
P.S. If this explanation has any missing holes or logic, please let me know! Thank you!
Thanks for reaching out.
Actually, the task is:
"Select the employee numbers of all individuals who have signed more than 1 contract after the 1st of January 2000."
So, you are right. Some of the employees have worked in more than 1 department.
Hope this helps.