0% found this document useful (0 votes)
37 views19 pages

Questions On Subqueries

The document contains 112 questions on subqueries related to querying employee data from a database. The questions cover a wide range of subquery types including correlated subqueries, non-correlated subqueries, single-row subqueries, multiple-row subqueries, and analytic functions. The questions involve filtering rows based on conditions with other tables/queries, aggregating data, retrieving minimum/maximum values, and joining data from multiple tables.

Uploaded by

samuelthomas4646
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views19 pages

Questions On Subqueries

The document contains 112 questions on subqueries related to querying employee data from a database. The questions cover a wide range of subquery types including correlated subqueries, non-correlated subqueries, single-row subqueries, multiple-row subqueries, and analytic functions. The questions involve filtering rows based on conditions with other tables/queries, aggregating data, retrieving minimum/maximum values, and joining data from multiple tables.

Uploaded by

samuelthomas4646
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

QUESTIONS ON SUBQUERIES

1. list the department names that are having no employees at all

2. display all the employees whose job is same as scott

3. display scott manager’s manager’s department name

4. list employees whose job is same as scott and their salary greater than smith’s salary

5. display all the employees whose job is same as scott and allen

6. display all the employees who are actual managers


7. display who are all the employees reporting to scott

8. display the 2nd maximum salary

9. display the 3rd maximum salary

10. display all the employees who are earning more than all the managers(job).

11. display all the employees who are earning more than any of the manager(job)

12. select empno, job and salary of all the analyst who are earning more than any of the

manager(job)

13. select the department name and location of all the employees working for clark.
14. select all the employees working for dallas

15. display all the employees whose salary is greater than avg sal of department 20

16. display all the employees who gets maximum salary.

17. display first employee record based on hiredate

18. list the employees who has salary greater than allen

19. list the department names that are having analysts

20. list the department names which are having salesmen in it.

21. display the employees whose location is having at least one ‘o’ in it.
22. list the department names that are having at least 1 employee in it.

23. list the department names that are having at least 4 employees in it

24. display the department names which are having at least 2 clerks in it

25. query to display the employee names who is having maximum salary in dept name

"accounting"

26. query to display the dept name who is having highest commission

27. query to display all the employees whose dept number is same as scott.

28. query to display all the employees in 'operations and accounting' dept. list the employees

who has salary greater than miller


29. list department name having atleast 3salesman

30. display all employess who do not have any reporter.

31. list all the employees who are reporting to jones manager

32. list employees from research&accounting having atleast 2 reporting.

33. display the departname of the employee whose name does not starts with s and salary

between 1500 to 3000.

34. display location of employee whose salary is minimum salary but salary is greater than

2000

35. display the location of an employee in accounting department.


36. display the department location that are having greater than four employees in it.

37. write a query to display all the employee whose job not same as allen and salary is

greater than martin

38. display all the employees who is having location is same as adam's manager

39. display the job, manager of employees who is working for jones?

40. display the employee names, higher date, commission of ford's manager?

41. display the number of employees who are getting salary less than the blake's manager

42. list employees who located in chicago and their commission is zero.
43. list employees who work for sales department and their salary greater

44. than average salary of their department.

45. list employees who are working in research department and they are manager.

46. display department name of the employees who earn commission.

47. display department name of the employee who earn maximum salary and have no

reporting manager.

48. display employee details who are reporting to blake and have commission without using

null or not null

49. list all the deptname and loc of all the salesman manager-manager's
50. list the employee deptname and loc of all the employees who are clerk ,reporting to blake

and salary is lesser than martin salary

51. list the employees who does not directly report to president,have commission and salary

more than max salary of all the clerk without using null or not null

52. list the employees who joined after 2 years of first employee of the company and more

than blake salary

53. display location of all the employees who reporting to blake

54. list all the employees whose job is same as jones and their salary lesser than scott

55. display the king's first year salary and his location with department
56. display all the employees of department 30, 20 with there anual salary and having atleast

3 employees

57. display department name which is having second highest average salary and third

highest induvidul salary

58. display all the employees who are earn less than any of the salesman?

59. display all the employees who are joined before the last person?

60. display last but one employee record?

61. find 3rd minimum salary in the employee table

62. display all the employees who are earning more than any of the manager.
63. list employees who joined after 4 years of 1st employee of the company and less than

blake salary.

64. display the department information of employee who is working for newyork location

65. display the salary wise employee information for deptno 20 in descending order

66. display second employee record

67. display location of employees, whose name doesn't start with a and salary between 1000

and 3000.

68. display department name of all the employees who are reporting to blake.

69. display martin's manager's manager's department location.


70. display the employee name and their salary who joined 2 years before the last person

hired

71. display the employee name,job and department for those who don't have commission

72. display the employee details with their location who earn maximum commission

73. display all the employee whose department is sales and who is earning some

commission (i.e commission is not null or zero)and whose hired before the last person hired.

74. display all the department names and manager who is ward's manager's manager

75. display department names and maximum commission of employee's whose salary is

greater than average salary of all the clerk's

76. display the last employee record with location.


77. display the department number who working in sales department and they are manager.

78. display department name of the employee who earn minmum salary and have reporting

manager.

79. display hiredate and dname of all the employees working for sales

80. display location and dname of employee who working as president

81. display the dname of employees whoes salary is maximum salary but lesser than 3000

82. display the department name who are reporting to adams.

83. display last employee record.


84. display all the employee whose salary is greater than average salary of department 30.

85. display the number of employees who work for research dept and their salary is lesser

than one of the salary in department in 10.

86. display the dname that are having clerk in it.

87. display the department names that are having atleast one l in it.

88. display all the employees who are joined after blake.

89. list the dept name that are having at least 3 employees but not more than 5 employees in

it.

90. display the location of all employees whose reporting manager salary is greater than

2000.
91. select the employees whose dname is having at least two 'e' in it.

92. display ename,sal of employees who are earning more than any of the analyst.

93. select all the employees who are working for chicago

94. query to display employee names who is having minimum salary in department research

95. list the department names that are having salesman.

96. list the department names that are having at least 3 employes in it.

97. list employees from research and accounting department having atleast two reporting
98. write a query to display employee name, job,dname,location of all employees who are

working as manager and works at chicago.

99. select ename,dname of employee who earns 2nd max salary and works for location

dallas.

100. write a query to display the employee information who is not taking commission and

joined company after july 83.

101. list employees from sales and research department having atleast 2 reporting employees

102. list employees who have commission greater than maximum salary of all the salesman

and who do not report to king directly

103. display the location of all the deaprtments which have employees joined in the year 81
104. display department wise minimum salary which is less than average salary of employees.

105. display all the employees who are reporting to 'jones'.

106. display all the employee information who are living in a location which is having at least 2

'o' in it.

107. display the names of employee from department number 10 with salary greater than that

of all employee working in other departments.

108. display the names of employees who earn highest salary in their respective jobs.

109. display the employee number and name of employee working as clerk and earning

highest salary among clerks

110. write a query to find smith's manager's manager hiredate.


111. list the number of employees whose job is salesman working for newyork and chicago

112. list the department names in which the employees are hired between 1st of jan 1981 and

31st dec 1982 with salary more than 1800.

113. display location of the employee who earn maximum salary and have no reporting

manager

114. list employees who works for accounting department and their salary greater than

average salary of their department

115. display location of the employee who earn commission

116. list the employees who does not directly report to president,have commission and salary

more than max salary of all the clerk without using null or not null
117. display all the employees whose salary is greater than avg sal of department 20

118. list the employee deptname and loc of all the employees who are clerk ,reporting to

blakeand salary is lesser than martin salary

119. display ename, dname whose job is manager.

120. display employees location who has some commission.

121. display empno, ename, job, whose job has 'e' in it and display empno in descending

order.

122. display dname, loc,deptno of employees who has same reporting manager???

123. display avg salary of all employees whose dept name is accounting???
124. display all employees details whose hiredate is in year 81???

125. dispay details of smith including his location

126. display number of employees whose commission is more than salary.

127. list the employees whose daily salary is greater than 150 and who are joined before 1982

only.

128. query to display the employee names whose name as 2nd character should be 'o'

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy