Assignment 4
Assignment 4
3) List names of employees who are more than 2 years old in the
company.
4) List the employee details in the ascending order of their basic salary.
select * from emp order by sal;
5) List the employee name and hire date in the descending order of the
hire date.
select ename, hiredate from emp order by hiredate desc ;
6) List employee name, salary, PF, HRA, DA and gross; order the
results in the ascending order of gross. HRA is 50% of the salary and
DA is 30% of the salary.
select ename , sal, sal*0.1 "PF" , sal*0.5 "HRA", sal*0.3 "DA" ,
sal+sal*0.1+sal*0.5+sal*0.3 "Gross" from emp order by
sal+sal*0.1+sal*0.5+sal*0.3 ;
9) List the jobs and number of employees in each job. The result should
be in the descending order of the number of employees.
10) List the total salary, maximum and minimum salary and average
salary of the employees job wise.
select job ,sum(sal) , max(sal), min(sal) , avg(sal) from emp group by
job;
11) List the total salary, maximum and minimum salary and average
salary of the employees, for department 20.
12) List the total salary, maximum and minimum salary and average
salary of the employees job wise, for department 20 and display only
those rows having a average salary > 1000
select job deptno,sum(sal) , max(sal), min(sal) , avg(sal) from emp
where emp.deptno=20 group by job having avg(sal) > 1000 ;