4. Show the following details for any employee who earns a salary greater
than the average for their department. Sort in department number order.
without using top or set.
ename salary deptno
-------------- ----------------- -----------
KING 5000.00 10
JONES 2975.00 20
FORD 3000.00 20
SCOTT 3000.00 20
ALLEN 1600.00 30
BLAKE 2850.00 30
(6 row(s) affected)
In which year did most people join the company? Display the year
and the number of employees.
year no_of_emp
----------- -----------
1984 8
(1 row(s) affected)
Write a query to display an "*" against the row of the most recently
hired employee. Display ename, hiredate and the column maxdate showing "*.
ename hiredate maxdate
------------- ----------- -------
ADAMS Jun 4 1984
ALLEN Aug 15 1983
BLAKE Jun 11 1984
CLARK May 14 1984
FORD Dec 5 1983
JAMES Jul 23 1984 *
JONES Oct 31 1983
KING Jul 9 1984
MARTIN Dec 5 1983
MILLER Nov 21 1983
SCOTT Mar 5 1984
SMITH Jun 13 1983
TURNER Jun 4 1984
WARD Mar 26 1984