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

Why does for update in oracle 8 cause an ora-01002 error?

0 Answers  


can anyone help me ? an index has been done on the primary key of a table. an update operation was performed on that table. now my question is 1> what abt the performance ? means faster or slower due to indexing ? 2> does the operation affect to the primary key constraint ?

2 Answers   Allfon,


How to install oracle database 10g xe?

0 Answers  


Can Multiple instances be run on Single Machine???

3 Answers  


Differentiate between pre-select and pre-query?

0 Answers  






What is merge in oracle?

0 Answers  


What are the tools for Oracle ?

0 Answers   Infosys,


I have table-A(1,2,3,4,4,5,6,6,6,7). how to get all duplicate values?what is sql query?

5 Answers   Zensar,


What is Database Buffers ?

1 Answers  


Explain an exception?

0 Answers  


What is Private Database Link ?

1 Answers  


24. Display the order number for all orders whose average item cost is greater than the overall average item cost across all orders.

2 Answers   Wipro,


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)