You are on page 1of 2

EMP & DEPT Table related Queries. 1. To find nth maximum salary another query is 2.

Find the job which is not allocated to any working at Boston. 3. Display all the details where Sal > lowest Sal of employees in deptno 20. 4. Display details of all employees whose salary is greater than average salary of employees in respective departments. 5. Find the employee name and his manager from the EMP table. 6. Find the department which is not allocated to clerk. 7. Find the employees who are having the same hire date. 8. Show all data of the clerk who have been hired after the year 1981. 9. Display the 1st and 2nd highest salaries from each department. 10. Department wise maximum salary. 11. Display the employee whose salary is greater than their manager. 12. Display the employee who is working in the same department where his manager is working. 13. Display the employee name whose manager is Blake. 14. Display the manager name who manages the maximum number of employees. 15. Select common job for deptno 10 & 20. 16. Select employee who are manager. 17. Select employee who are not manager. 18. Display employee without manager. 19. Display mgr and number of employees working under him. 20. Find the employee who joined after 15-MAR-1981. 21. Display the employee name who is manager. 22. Find out the employee who earned the highest salary in each job type sort by descending salary. 23. Display ename, deptno, avg (Sal) of their respective department. 24. Find out the 2nd highest salary of deptno 10. 25. Find out the 2nd lowest salary of deptno 10. 26. Find the name of department which is not allocated to clerk. 27. Find the 2nd highest salary. 28. Delete duplicate rows from the table. 29. Display the employees whose job is same as that of Jones. 30. Display employees belonging to Millers department. 31. Display all the employees reporting to King. 32. Display all the employees who are getting maximum salary. 33. Display all the details where salary greater than Millers salary and who are in sales department. 34. Display all the details who have joined in same date as that of James. 35. Display all the details where department is either sales or research. 36. SELECT ENAME,JOB,MGR FROM EMP WHERE (JOB,MGR) IN (SELECT JOB,MGR FROM EMP WHERE EMPNO=7788); 37. Display details of all employees whose salary is > average salary of employees in respective departments.

38. Display the entire employee details where salary > lowest salary of employees in deptno=20. 39. List the department name, employee name, employee number. 40. List the total salaries of each department. 41. List the total employees salary that doesnt belong to any department. 42. List the managers name and employees name that belongs to their managers. 43. Display information about employees who earn more than any employees in deptno=30. 44. List all the employees in deptno=10 with the same job as in deptno=30. 45. List the employees with either the same job as Jones or salary greater than or same as Ford. 46. List the employees in deptno=10 with the same job as anyone in sales department. 47. List employees whose salary is same as that of Scott or Ward. 48. List the department that has no employees. 49. List the department and count of job in which there is more than one salesman. 50. List the department in which there is more than one salesman. 51. Query department wise Maximum, Minimum and Average salaries. 52. Count the number of male and female employees. 53. Display the year and number of employees for the year in which more than one employee was hired. 54. Display last 5 records in EMP table. 55. List 5 employees in lowest order of salaries. 56. List the employees whose salary greater than or equal to average salary of deptno=10. 57. List the different designations in departments 20 and 30. 58. List the jobs common in departments 20 and 30. 59. List the jobs unique to department 20. 60. List the employees if an only if more than 3 employees are present in deptno=20. 61. List the employee names whose salary is greater than the lowest salary of an employee belonging to deptno=20. 62. List 5 employees in highest order of salaries. 63. List the employee name, salary and deptno for each employee who earns a salary greater than the average for their department order by deptno. 64 List the number of employees and average salary within each department for each job. 65. Find the maximum average salary drawn for each job except for President. 66. List the name, job and salary of the employees who are not belonging to the department no 10, but who have the same job and salary as the employees of department no 10. 67. List the deptno, name, job, salary + comm. Of the SALESMAN who are earning maximum salary and commission in descending order. 68. List the deptno and their average salaries for dept with average salary less than the average for all departments.

You might also like