Consider I have the below tables created and the relationships are created as per the ER Diagram.
I have been asked to find which project(s) have the least number of employees. I tried to use the below code, but I am getting only 1 output, whereas I am expecting two records to be created as per the data fed:
select pname from project p where pnumber = (select min(count) from (select count(*) from works_on group by pno)t)
Below are the data in the table:
Project Table:
Works_On Table: