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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

From the following identify the non schema object: packages, triggers, public synonyms, tables and indexes.

586


Explain rename?

549


What is the purpose of tables, private synonyms and public synonyms in Oracle?

587


Can we use oracle pl/sql block in core java? if so how? pls get back to me .....

2502


How to retrieve data from an cursor to a record?

560






Is there a function to split a string in plsql?

568


What privilege is needed for a user to connect to oracle server?

555


How to start an oracle instance?

572


How to run queries on external tables?

566


What is a synonym? What are its various types?

622


What is the difference between a user and a schema in oracle?

558


How to invoke the data pump import utility?

648


In not less than 100 words what's the main difference between Rolap and Molap in ORACLE ?

1777


What is ordinary table in oracle?

650


How do we get field details of a table?

547