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 |
How to create an initialization parameter file?
What is the difference between normal and corelated subqueries?
What is the data pump import utility?
How to concatenate two text values in oracle?
What are the factors that affect OPTIMIZER in choosing an Optimization approach ?
How to see free space of each tablespace?
Can multiple columns be used in group by in oracle?
Write a trigger example in oracle?
How to rename an index in oracle?
Maximum how many triggers can be updated in table ?
5 Answers Accenture, Cap Gemini,
What privilege is needed for a user to insert rows to tables in another schema?
What is sharded cluster?