Q&A.
Ques 1) List the no. of jobs available in the EMPLOYEE table.
select distinct job from employeeQues 2) List the total salaries payable to the employees.
select sum(sal) from employeeQues 3) List the maximum salary of employees working as a salesman.
select max(sal) from employee where jab like 'SALESMAN'Ques 4) List the minimum salary of EMPLOYEE table.
Ques 5) List the total salary, maximum, minimum & average salary of employee job wise.
select job, sum(sal), max(sal), min(sal), avg(sal) from employee group by jobQues 6) List the average salary from each job excluding managers.
Ques 7) List department number, average salary for all departments employing more than 5 people.
select deptid, avg(sal) from employee having count(empid) > 5Ques 8) List jobs of all the employees where maximum salary >= 5000.
select job from employee having max(sal) >= 5000Ques 9) List the employee’s no.s, names, deptno. & department names.
select empno, ename, deptno, dname from employee inner join dept on employee,deptno = dept.deptnoQues 10) List the worker names & their corresponding managers from Employee table.
select e.ename, m.ename as "MANAGER" from employee e inner join employee m on e.mgr = m.empnoQues 11) List all employees to join the company before their managers.
select e.ename, e.hiredate, m.ename, m.hiredate from employee e inner join employee m on e.mgr = m.empno where m.hiredate > e.hiredateQues 12) Display the total salary beginning paid to all employees.
select sum(sal) from employeeQues 13) Display the average salary from employee table.
select avg(sal) from employeeQues 14) Display the maximum salary being paid to CLERK.
select max(sal) from employee where job like 'CLERK'Ques 15) Display the maximum salary being paid to depart number 20.
select max(sal) from employee where deptno = 20Ques 16) Display the minimum salary being paid to any SALESMAN.
select min(sal) from employee where job like 'SALESMAN'Ques 17) Display the average salary drawn by MANAGERS.
select avg(sal) from employee where job like 'MANAGER'Ques 18) Display the total salary drawn by ANALYST working in dept number 40.
select sum(sal) from employee where job like 'ANALYST' and deptno = 40Ques 19) Display the names of the employees in Uppercase.
select upper(ename) from employeeQues 20) Display the names of the employees in Lowercase.
select lower(ename) from employeeQues 21) Display the names of the employees in Proper case.
select initcap(ename) from employeeQues 22) Display the length of your name using appropriate function.
select length(ename) from employeeQues 23) Display the various jobs and total number of employees within each job group.
select job, count(empno) from employee group by jobQues 24) Display the depart numbers and total salary for each department.
select deptno, sum(sal) from employee group by deptnoQues 25) Display the depart numbers and max salary for each department.
select deptno, max(sal) from employee group by deptnoQues 26) Display the various jobs and total salary for each job.
select job, sum(sal) from employee group by jobQues 27) Display the various jobs and total salary for each job.
select job, sum(sal) from employee group by jobQues 28) Display the department numbers with more than three employees in each dept.
select deptno from employee group by deptno having count(empid) > 3Ques 29) Display total no. of employees in each department. Result should be in descending order of no. of employees.
select deptno, count(empno) from employee group by deptno order by count(empno) descQues 30) Display the average salary of employees in each department. Display result in ascending order of salary.
select deptno, avg(sal) from employee group by deptno order by avg(sal)
0 Comments
If you have any doubt. Let me know.