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



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

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

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

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

Post New Answer

More Oracle General Interview Questions

How to create an initialization parameter file?

0 Answers  


What is the difference between normal and corelated subqueries?

2 Answers  


What is the data pump import utility?

0 Answers  


How to concatenate two text values in oracle?

0 Answers  


What are the factors that affect OPTIMIZER in choosing an Optimization approach ?

2 Answers  






How to see free space of each tablespace?

0 Answers  


Can multiple columns be used in group by in oracle?

0 Answers  


Write a trigger example in oracle?

0 Answers  


How to rename an index in oracle?

0 Answers  


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?

0 Answers  


What is sharded cluster?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)