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

What is a Redo Log ?

3 Answers  


What is the meaning of recursive hints in oracle?

0 Answers  


What privilege is needed for a user to insert rows to tables in another schema?

0 Answers  


How to define an explicit cursor in oracle?

0 Answers  


What are the different type of Segments ?

2 Answers  






Explain compound trigger in oracle?

0 Answers  


what are bitmap indexes? How does they work?

0 Answers  


What is a connect identifier?

0 Answers  


What are a query and state the different types of queries and their uses?

0 Answers  


Is primary key indexed by default in oracle?

0 Answers  


What are various joins used while writing SUBQUERIES?

2 Answers  


What is where clause in oracle?

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)