SQL Assign
SQL Assign
SQL Assign
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
Dept
DEPTNO
DNAME
LOC
Salgrade
GRADE
LOSAL
HISAL
49. List all the department names along with the names of employees in them , irrespective of the fact whether any
employee is there or not.
50. List all the department names along with the names of managers in them , irrespective of the fact whether any
manager is there or not.
51. Find names, job and salaries of all employees and also his immediate boss.
52. Find the names of those employees who earn more than their boss.
53. Find all the employees who are senior to their bosses.
54. Find the names of those employees whose immediate boss is in different department.
55. List all the employee names along with the names of their bosses, irrespective of the fact whether any employee
has boss or not.
56. List department number and each distinct pair of employees working in that department.
57. Display highest, lowest, sum and average salary of all the employees. Round your result to whole numbers.
58. Display highest, lowest, sum and average salary for each job.
59. Count the number of bosses without listing them.
60. Display the difference between the highest and lowest salary.
61. Display department name and the difference between the highest and lowest salary for that department.
62. Display department name and average salary for that department. Include only those employees who have
joined after 1st July 2001.
63. Display the boss and the salary of lowest paid employee for him. Dont include minimum salary below Rs.
1000/-.
64. Display department name, location name, no. of people working there and average salary. Round average salary
to 2 decimal places.
65. Count distinct salary figures and number of employees receiving it.
66. Find all the department details in which at least one employee is working.
67. Find all, who are bosses of least one employee.
68. Find average annual salary of all the employees except analysts.
69. Create unique listing of all the jobs that are in dept. 30. Include location of the dept. in the output.
70. List employee name, dept. name, job and location of all employees who work in DALLAS.
71. List employee name and hiredate of all employees who are hired after BLAKE.
72. List employee name , hiredate, manager name, managers hiredate of all employees who are hired before
their managers.
73. Display the job and the difference between the highest and the lowest salary for each job.
74. Display dept. name, location, no.of employees in the dept. and average salary of the dept. rounded to 2 decimal
places.
75. List employee name and hiredate of all employees who are in the same dept. as BLAKE. Exclude BLAKE.
76. Display names and salary of all the employees who report to KING.
77. 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.
78. 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.
79. List employees who earn salary higher than the highest salary of clerks.
80. List employees whose salary is higher than the average salary of employees in department no. 10.
81. Display the names of employees who are earning minimum and maximum salary in one line.
82. Find out top 4 salaries of the company. Display their rank as well
83. Find out earliest 3 employees who have joined the company. Display their rank as well.
84. Print employee name, salary and average salary of his department.
85. Display ename, department name and grade of each employee who joined the organization before their boss.
86. Display each deprtment name and the first employee who joined that department.
87. How much more salary Miller needs to earn to be in Kings grade?
88. Display employees who joined in the last month(1st day of last month Last day of last month). Do not hardcode
the month name.
89. How much more salary does each person need to earn to go in the next grade?
90. List different locations from where employees are reporting to King.
91. List different grades of employees working in DALLAS
92. Display grade 2 employees in Finance department who will complete 3 years in March this year.
93. Display employees who are earning salary more than the average salary of employees in the same grade.
94. Display employees who are in that same grade as Miller and do not belong to the place which Miller belongs to.
95. How many employees are there between the highest grade of a clerk and the lowest grade of a manager?
96. List analysts and clerks who are either staying at Chicago or Boston and in grade 3 and above.
97. Display department name, grade, Max salary offered to each grade at each department.
98. Whos earning the best salary in each grade and where do they live?
99. Display the locations where total salary of grade 3 employees is greater than total salary of grade 4 employees.
100. Display grade, highest salary in that grade and lowest salary in that grade.
101. Display location, highest salary in that location and lowest salary in that location.
102. Display the department names where every employee is earning more than 2000.
103. Display the dept name, difference between hisal of highest earning employee in that dept and average salary for
every department.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.