Answer the question
In order to leave comments, you need to log in
Compose correct SQL query?
There are two such tables. It is necessary to display the names of departments in which the number of employees does not exceed 3 people.
select department_id
from employee
group by department_id
having count(*) <= 3 // Display the IDs of these departments, but how do we display the department names?
Answer the question
In order to leave comments, you need to log in
select id, name
from department
where id in (
select department_id
from employee
group by department_id
having count(*) <= 3
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question