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
Answers were Sorted based on User's Feedback
Answer / anithaletchumi
select d.deptid,count(e.empid) as countofEmployee from
department d left outer join employee e on
d.deptid=e.deptid group by d.deptid
Is This Answer Correct ? | 4 Yes | 2 No |
Answer / 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 |
What is a Redo Log ?
What is the meaning of recursive hints in oracle?
What privilege is needed for a user to insert rows to tables in another schema?
How to define an explicit cursor in oracle?
What are the different type of Segments ?
Explain compound trigger in oracle?
what are bitmap indexes? How does they work?
What is a connect identifier?
What are a query and state the different types of queries and their uses?
Is primary key indexed by default in oracle?
What are various joins used while writing SUBQUERIES?
What is where clause in oracle?