A query to list the names of the departments which employed more than 10 employees in the last 3 months

 ```sql

SELECT D.name

FROM Department D 

JOIN Employee E ON D.id = E.department_id

JOIN Salary_Payments SP ON E.id = SP.employee_id

WHERE SP.date > DATE_SUB(CURDATE(), INTERVAL 3 MONTH)

GROUP BY D.name

HAVING COUNT(DISTINCT E.id) > 10;

```

Post a Comment

Thankyou

Previous Post Next Post