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

structural difference between bitmap and btree index ?

1 Answers   Infosys,


What is hot backup and logical backup?

0 Answers  


What are internal user account in oracle?

0 Answers  


How to Identify the previously inserted/updated records in already populated table.

0 Answers  


various types of hints and their usage

0 Answers  






Does a Before form trigger fire when the parameter form is suppressed ?

1 Answers   Oracle,


What is an Oracle Instance?

0 Answers  


Query to retrieve record for a many to many relationship ?

0 Answers   Keane India Ltd,


How can we create the complete backup of data in the oracle.

0 Answers   IPEC, Satyam, SunTec,


How to do paging with oracle?

0 Answers  


What is where clause in oracle?

0 Answers  


What is a Sequence ?

3 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)