Company Database
Company Database
select name
from employee e
where not exists
((select pno from project where dno=2) minus
(select pno from works_on where ssn = e.ssn));
5. For each department that has more than five
employees, retrieve the department number and
the number of its employees who are making more
than Rs. 6,00,000.
select d.dno, count(*) as count
from department d,employee e
where d.dno= e.dno and salary >600000
and d.dno in
(select dno from employee
group by dno having count(*)>3)
group by d.dno;
select dno, count(*) as count
from employee
where salary >600000
and dno in
(select dno from employee
group by dno
having count(*)>5)
group by dno;