how to make this query ?
Date: Tue, 07 May 2002 12:47:14 GMT
Message-ID: <Xns9207E21282649pratikkhasnabis_at_203.134.67.67>
I have two tables for employees and department.
1. EMP
the task is to find the department with largest no of employees with a
single query.
I am not a student , this was resulting from a discussion with a colleague.
I have very basic knnowldege of SQL. The constraint is not to use temporary
tables , views , PL/SQL and other oracle specific feature. ANSI SQL
solution is most preferred.
My query so far is
SELECT DEPTNO , count(*) AS TOTAL FROM EMP GROUP BY DEPTNO ORDER BY TOTAL
DESC LIMIT 1
columns are NAME (varchar) and DEPTNO (number)
2. DEPT
columns are DEPTNO (number) DEPTNAME (varchar)
i.e to show the DEPTNAME , DEPTNO and no. of employees.
I have only mySQL at home to try this which doesn't support sub select.
If anyone can formulate the query in oracle. I can test it at my work.
pratik Received on Tue May 07 2002 - 14:47:14 CEST