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 ?    0 Yes 0 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 ?    22 Yes 23 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 ?    0 Yes 2 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 23 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 ?    38 Yes 41 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 4 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 9 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 23 No

Post New Answer



More Oracle General Interview Questions

Hi this srilatha. I comlpeted my Oracle-hrms. can u provide me interview questions on Core hr, payroll,sshr,OLM etc..

0 Answers  


What is Java Pool in Oracle?

0 Answers   MCN Solutions,


Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ...

10 Answers   Sony, Cognizant, Verizon, NTTF Nettur Technical Training Foundation, ID,


Difference between primary key and unique key ?

77 Answers   L&T, R Systems, Accenture, Cognizant, Keane India Ltd, Shakti, B2B Software Technologies, HP Finsoft, IndiaNIC, Karomi Technology, Onward eServices, Techtic Solutions,


What is the difference difference between $ORACLE_HOME and $ORACLE_BASE.

0 Answers   MCN Solutions,






What is TNS File

7 Answers   Thermotech,


What are the benefits of ordbms?

0 Answers  


how to use sequence and what use of sequence cache

1 Answers  


How many types of cluster table in Oracle?

0 Answers   MCN Solutions,


What is Trigger in Oracle?

0 Answers   MCN Solutions,


What are the types of Database Links ?

2 Answers  


what are the differen between key flexifild and discriptive fiexifild.

1 Answers  






Categories
  • Oracle General Interview Questions Oracle General (1003)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (0)
  • 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 (484)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (0)
  • Oracle RAC Interview Questions Oracle RAC (20)
  • Oracle D2K Interview Questions Oracle D2K (53)
  • Oracle AllOther Interview Questions Oracle AllOther (241)