Assignment 3
Assignment 3
NV L(C OM M, 0)
0
300
500
0
1400
0
0
0
0
0
select COUNT(job)
from emp
where job='CLERK';
C OU NT (JOB)
4
select COUNT(job)
from emp
where job='CLERK' and hiredate>'01-JAN-81';
C OU NT (JOB)
3
DE PT N O C OU NT (E N AME )
30 6
20 5
10 3
6. Find the overall total of basis salary and commission for all employees.
S UM (S AL) S UM (C OM M)
29025 2200
E N AME C OMPE NS AT I ON
JONES 35700
BLAKE 34200
CLARK 29400
AV G (S AL)
1400
M IN(E N AME )
ADAMS
10. Find the maximum salary of the employees in various departments, job-wise.
J OB DE PT N O M AX (S AL)
MANAGER 20 2975
PRESIDENT 10 5000
CLERK 10 1300
SALESMAN 30 1600
ANALYST 20 3000
MANAGER 30 2850
MANAGER 10 2450
CLERK 30 950
CLERK 20 1100
11. Find the minimum and maximum salary of all managers in all departments.
12. Find the minimum salary of all managers in the departments where the minimum salary is above
Rs. 2500.
select deptno,job,min(sal) from emp group by job,deptno having job='MANAGER' and min(sal)>2500
DE PT N O J OB M IN(S AL)
20 MANAGER 2975
30 MANAGER 2850
13. Find the minimum salary and job of various categories of employees.
J OB M IN(S AL)
CLERK 800
SALESMAN 1250
PRESIDENT 5000
MANAGER 2450
ANALYST 3000
14. List the maximum salary of employees department wise and display only those departments
whose maximum salary is greater than 1500.
DE PT N O M AX (S AL)
30 2850
20 3000
10 5000
15. List the various categories of employees and their departments such that the maximum salary is
greater than 1500.
16. Write queries to differentiate between COUNT (*), COUNT (expr) and COUNT (distinct).
10.*
select max(sal) from emp group by job;
M AX (S AL)
1300
1600
5000
2975
3000