You are on page 1of 3

Set 1: Tables Emp, Dept, salgrade 1. Query Emp table. 2. Select the employees in department 30. 3.

List the names, numbers and departments of all clerks. 4. Find the department numbers and names of employees of all departments with deptno greater than 20. 5. Find employees whose commission is greater than their salaries. 6. Find employees whose commission is greater than 60 % of their salaries. 7. List name, job and salary of all employees in department 20 who earn more than 2000/-. 8. Find all salesmen in department 30 whose salary is greater than 1500/-. 9. Find all employees whose designation is either manager or president. 10. Find all managers who are not in department 30. 11. Find all the details of managers and clerks in dept 10. 12. Find the details of all the managers (in any dept) and clerks in dept 20. 13. Find the details of all the managers in dept. 10 and all clerks in dept 20 and all employees who are neither managers nor clerks but whose salary is more than or equal to 2000/-. 14. Find the names of anyone in dept. 20 who is neither manager nor clerk. 15. Find the names of employees who earn between 1200/- and 1400/-. 16. Find the employees who are clerks, analysts or salesmen. 17. Find the employees who are not clerks, analysts or salesmen. 18. Find the employees who do not receive commission. 19. Find the different jobs of employees receiving commission. 20. Find the employees who do not receive commission or whose commission is less than 100/-. 21. If all the employees not receiving commission is entitles to a bonus of Rs. 250/- show the net earnings of all the employees. 22. Find all the employees whose total earning is greater than 2000/- . 23. Find all the employees whose name begins or ends with M 24. Find all the employees whose names contain the letter M in any case. 25. Find all the employees whose names are upto 15 character long and have letter R as 3rd character of their names. 26. Find all the employees who were hired in the month of February (of any year). 27. Find all the employees who were hired on last day of the month. 28. Find all the employees who were hired more than 2 years ago. 29. Find the managers hired in the year 2003. 30. Display the names and jobs of all the employees separated by a space. 31. Display the names of all the employees right aligning them to 15 characters. 32. Display the names of all the employees padding them to the right up to 15 characters with *. 33. Display the names of all the employees without any leading A. 34. Display the names of all the employees without any trailing R. 35. Show the first 3 and last 3 characters of the names of all the employees. 36. Display the names of all the employees replacing A with a. 37. Display the names of all the employees and position where the string AR occurs in the name. 38. Show the salary of all the employees , rounding it to the nearest Rs. 1000/-. 39. Show the salary of all the employees , ignoring the fraction less than Rs. 1000/-. 40. Show the names of all the employees and date on which they completed 3 years of service. 41. For each employee, display the no. of days passed since the employee joined the company. 42. For each employee, display the no. of months passed since the employee joined the company. 43. Display the details of all the employees sorted on the names. 44. Display the names of the employees, based on the tenure with the oldest employee coming first. 45. Display the names, jobs and salaries of employees, sorting on job and salary.

46. Display the names, jobs and salaries of employees, sorting on descending order of job and within job sorted on salary. 47. List the employee names, department names and salary for those employees who have completed 1 year of service. 48. List the employee names, department names and salary for those employees who are earning 0 commission or commission is null. Sort your output in the order of department name. 49. List the employee names, department names and hiredate for those employees who have joined in 2003 . Sort your output in the order of joining date. 50. List all the department names along with the names of employees in them , irrespective of the fact whether any employee is there or not. 51. List all the department names along with the names of managers in them , irrespective of the fact whether any manager is there or not. 52. Find names, job and salaries of all employees and also his immediate boss. 53. Find the names of those employees who earn more than their boss. 54. Find all the employees who are senior to their bosses. 55. Find the names of those employees whose immediate boss is in different department. 56. List all the employee names along with the names of their bosses, irrespective of the fact whether any employee has boss or not. 57. List department number and each distinct pair of employees working in that department. 58. Display highest, lowest, sum and average salary of all the employees. Round your result to whole numbers. 59. Display highest, lowest, sum and average salary for each job. 60. Count the number of bosses without listing them. 61. Display the difference between the highest and lowest salary. 62. Display department name and the difference between the highest and lowest salary for that department. 63. Display department name and average salary for that department. Include only those employees who have joined after 1st July 2001. 64. Display the boss and the salary of lowest paid employee for him. Dont include minimum salary below Rs. 1000/-. 65. Display department name, location name, no. of people working there and average salary. Round average salary to 2 decimal places. 66. Count distinct salary figures and number of employees receiving it. 67. Find all the department details in which at least one employee is working. 68. Find all, who are bosses of least one employee. 69. Find average annual salary of all the employees except analysts. 70. Create unique listing of all the jobs that are in dept. 30. Include location of the dept. in the output. 71. List employee name, dept. name, job and location of all employees who work in DALLAS. 72. List employee name and hiredate of all employees who are hired after BLAKE. 73. List employee name , hiredate, manager name, managers hiredate of all employees who are hired before their managers. 74. Display the job and the difference between the highest and the lowest salary for each job. 75. Display manager and the salary of lowest paid employee of the manager. 76. Display dept. name, location, no.of employees in the dept. and average salary of the dept. rounded to 2 decimal places. 77. List employee name and hiredate of all employees who are in the same dept. as BLAKE. Exclude BLAKE. 78. Display names and salary of all the employees who report to KING.

79. Write a query to display name, dept. no, and salary of any employee whose is not located at DALLAS but his/her salary and commission match with the salary and commission of at least one employee located in DALLAS. 80. Display name , hire date and salary of all the employees who have both salary and commission same as SCOTT. Do not include Scott in the list. 81. List employees who earn salary higher than the highest salary of clerks. 82. List employees whose salary is higher than the average salary of employees in department no. 10. 83. Display the names of employees who are earning minimum and maximum salary in one line. 84. * Find out top 4 salaries of the company. Display their rank as well 85. * Find out earliest 3 employees who have joined the company. Display their rank as well. 86. Print employee name, salary and average salary of his department. 87. Display ename, department name and grade of each employee who joined the organization before their boss. 88. * Display each deprtment name and the first employee who joined that department. 89. * How much more salary Miller needs to earn to be in Kings grade? 90. * Display employees who joined in the last month(1st day of last month Last day of last month). Do not hardcode the month name. 91. How much more salary does each person need to earn to go in the next grade? 92. * List different locations from where employees are reporting to King. 93. * List different grades of employees working in DALLAS 94. Display grade 2 employees in Finance department who will complete 3 years in March this year. 95. Display employees who are earning salary more than the average salary of employees in the same grade. 96. Display employees who are in that same grade as Miller and do not belong to the place which Miller belongs to. 97. How many employees are there between the highest grade of a clerk and the lowest grade of a manager? 98. List analysts and clerks who are either staying at Chicago or Boston and in grade 3 and above. 99. Display department name, grade, Max salary offered to each grade at each department. 100.Whos earning the best salary in each grade and where do they live? 101.Display the locations where total salary of grade 3 employees is greater than total salary of grade 4 employees. 102.* Display grade, highest salary in that grade and lowest salary in that grade. 103.* Display location, highest salary in that location and lowest salary in that location. 104. Display the department names where every employee is earning more than 2000. 105.Display the dept name, difference between hisal of highest earning employee in that dept and average salary for every department. 106.Find all duplicate records in STUDENT table. 107.Delete all duplicate records from STUDENT table.

You might also like