Which Department has MOST NUMBER of employees?

Answers were Sorted based on User's Feedback



Which Department has MOST NUMBER of employees?..

Answer / sts

Select Deptno,Count(*) from Emp Group By Deptno having Count(*)=(SELECT max (count(*)) FROM EMP GROUP BY DEPTNO);

Is This Answer Correct ?    24 Yes 13 No

Which Department has MOST NUMBER of employees?..

Answer / mady

In SQL Server / MS Access:
==========================
select top 1 department_name
from EMPLOYEES
join DEPARTMENTS
on EMPLOYEES.department_id=DEPARTMENTS.department_id
group by department_name
order by count(*) desc;

In My SQL:
============
select department_name
from EMPLOYEES
join DEPARTMENTS
on EMPLOYEES.department_id=DEPARTMENTS.department_id
group by department_name
order by count(*) desc
limit 1;

Is This Answer Correct ?    24 Yes 29 No

Which Department has MOST NUMBER of employees?..

Answer / ns

SELECT count(*), department_id
FROM employees
GROUP BY department_id
HAVING count(*) =
(SELECT max(count(*))
FROM employees
GROUP BY department_id)

Is This Answer Correct ?    40 Yes 46 No

Which Department has MOST NUMBER of employees?..

Answer / shibashis

Select d.deptname,count(*) as cnt
from employee e inner join dept d
On e.deptid=d.deptid
group by d.deptname
having cnt in (
select max(cnt) from
(SELECT deptid ,count(*) as cnt FROM employee GROUP BY deptid )
)
order by d.deptname
;

Is This Answer Correct ?    1 Yes 7 No

Which Department has MOST NUMBER of employees?..

Answer / cvsrao

select d.deptname, count(*) as cnt from Employee e inner join
Department d on e.DeptId=d.DeptID
group by DeptName
having count(*) in
(select count(*) from
(select DeptId, count(*) as cnt from Employee group by DeptId)as cnt)

Is This Answer Correct ?    1 Yes 7 No

Which Department has MOST NUMBER of employees?..

Answer / senthil

select column_name,count(*)from table_name group by
column_name having count(*)=(select max(count(*)) from
table_name group by column_name);

PLZ Contact Any Queries (raja.prem86@gmail.com)

Is This Answer Correct ?    20 Yes 27 No

Which Department has MOST NUMBER of employees?..

Answer / aswini

select dept_id from emp group by dept_id having count(*)=(Select max(count(*)) From Emp group by dept_id)

Is This Answer Correct ?    2 Yes 14 No

Which Department has MOST NUMBER of employees?..

Answer / nannesaheb

SQL> Select Deptno,Count(*) from Emp
Group By Deptno
Having Count(*)=(Select Max(Count(*)) From Emp);


--If Any Queries Contact Me at nannesaheb.c@gmail.com
--Nannesaheb

Is This Answer Correct ?    8 Yes 26 No

Post New Answer

More Oracle General Interview Questions

I need to get the values of the previous quarter.how to do this?eg: if my cuurent month is may i need to get the datas of the month jan,feb,march.Can it be done in oracle.I tried with date function q but for the month jan its not retriving the previous quarter(oct-dec).how to solve this.plpz anyone help me?

2 Answers   Philips,


what is Materialized view? What is a snapshot? what are the similarities and differences between Materialized views and snapshots?

2 Answers  


what is the syntax of UPDATE command?

8 Answers  


State some uses of redo log files?

0 Answers  


Can multiple columns be used in group by in oracle?

0 Answers  






How many types of tables supported by oracle?

0 Answers  


How can I create database in oracle?

0 Answers  


How to change program global area (pga) in oracle?

0 Answers  


How to specify default values in insert statement using oracle?

0 Answers  


What is the difference between a hot backup and a cold backup in oracle?

0 Answers  


How a database is related to tablespaces?

0 Answers  


A table t is there.If you perform insert ,update and delete then the trigger will fire.What is the minimum no of trigger required for a table.

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)