Solution of SQL section
- Anuj Yadav
- Apr 2, 2020
- 1 min read
Question no 3.




select deptname,maxempcount from department;
Question no.4




select a.allocid,d.deptid,e.empid from allocation a join department d on d.deptid=a.did join employee e on e.empid=a.eid where d.deptid=100 or d.deptid=200;
Question no.5




select d.deptid,count(distinct e.empid) from employee e natural join department d natural join allocation a group by d.deptid;
Qusetion no.6




select d.deptname from allocation a join department d on d.deptid=a.did join employee e on e.empid=a.eid group by d.deptname having count(a.eid)>5;
Question no.7




select a.allocid,e.empid,e.empname from allocation a join department d on d.deptid=a.did join employee e on e.empid=a.eid where d.deptname='Finance';
Comments