Given two table employee and department
EMP
----------------
empid deptid(fk)


Dept
---------------------
deptid(pk) deptname


que-Write a query to find count of employee in each
department.


Expected Output-
deptid countofEmployee
---------------------------
10 57
20 20
30 15

Answer Posted / ajit

select d.deptno, count(e.deptno) total
from emp e, dept d
where e.deptno(+) = d.deptno
group by d.deptno;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens if you set the sga too low in oracle?

559


Explain the blob datatype?

622


How to convert csv to table in oracle?

528


What is a connect identifier?

543


Why do we need integrity constraints in a database?

590






interview questions with answer for cts

2090


How to create a table index in oracle?

662


What is a lookup table in oracle?

544


What is the difference between I and G in Oracle?

606


Explain table?

656


Does oracle charge for java?

592


How do you find current date and time in oracle?

591


How to create a table interactively?

562


How to select an oracle system id (sid)?

594


Explain a synonym?

608