Last answered:

31 Oct 2020

Posted on:

30 Oct 2020


Resolved: Modification in Solution

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?

1 answers ( 0 marked as helpful)
Posted on:

31 Oct 2020

Hi Archisman! 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! Kind regards,

Submit an answer