GeekInterview.com
Series: Subject:
Question: 149 of 165

There is 2 namely emp, dept
emp contains empid,ename,deptno
dept contains depid,deptno deptno is primary and deptno in emp is foreign key
My question is no of employees working in particular department . The display should show departname and no of employees in particular department.
Please answer to my email id

Asked by: Interview Candidate | Asked on: Jan 20th, 2006
Showing Answers 1 - 3 of 3 Answers
Laxmi Prasanna.Nedunuri

Answered On : Jan 27th, 2006

select dept.depid, count(emp.empid) from dept, emp where dept.deptno = emp.deptno group by dept.deptid

considering depid is department .

  
Login to rate this answer.
madhu

Answered On : Feb 23rd, 2006

the query is

select d.dname,count(*)

from emp e, dept d

where e.deptno = d.deptno

group by d.dname

  
Login to rate this answer.

select count(empid),d.deptname from emp, dept d where d.deptno=emp.deptno group by deptno

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.