0% found this document useful (0 votes)
20 views8 pages

Sub Querry Un Solved

Uploaded by

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

Sub Querry Un Solved

Uploaded by

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

SQL QUERIES ON SUB-QUERIES AND JOIN

1. List the departments which does not have empyloyee at all.

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

3.Display scott's manager's manager'S department name.

4.List employess 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 employees who are actual managers.

7.Display who are all employees reporting to scott.

8.Select 2nd maximum salary.

9. select 3rd maximum salary.

10.Display all the employees who earn more than all the managers(job).

11.Display all the employees who earn more than any the managers(job).

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

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

14. select all the employees working in dallas.

15.Display all the employees whose salary is greater than average salary of
deartment 20.
16.select all the employees who gets maximum salary.

17.Display first employee record based on hiredate.

18.list the employees who have salary greater than Allen.

19.list the daprtment names which are having analysts.

20.List the department names which have salesman in it.

21.Display the employees whose location which has atleast one o in it.

22.List the department names that are having at least one employee in it.

23.list the department names having atleast 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.Display all the employees in 'Operations and Accounting' Dept. list the
employees who has salary greater than miller

29. List department name having atleast 3 salesman

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


31. display all the employees who are not managers.

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 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 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 then Blake's
MANAGER salary.

42.List the employess who are located in chicago and their commission is zero.

43.List employees who work for sales department and their salary greater than
average salary of their department.
44.List employees who are working in research department and they are
manager.

45. Display department name of the employees who earn commission.

46.Display department name of the employee who earn maximum salary and
have no reporting manager.

47.Display employee details who are reporting to blake and have commission
without using null or not null.

48.List all the deprtnaments and loc of all the salesman's manager's manager.

49.List the employee deptname and loc of all the employees who are
clerk ,reporting to blake and salary is lesser than martin salary

50.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.

51. List the employees who joined after 2 years of first employee of the
company and more than blake salary.

52. Display location of all the employees who are reporting to Blake.

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

54. Display the king's first year salary and his location with department.
55. Display all the employees of department 30, 20 with their anual salary and
having atleast 3 employees.

56. Display department name which is having second highest average salary and
third highest induvidul salary.

57. Display all the employees who are earning less than any of the salesman.

58.Display all the employees who are joined before the last person

59.Display last but one employee record

60.Find third minimum salary in the employee table

61.Display all the employees who are earning more than any of the manager.

62. List employees who joined after 4 years of 1st employee of the company
and less than blake salary.

63.Display the department information of employee who is working for


newyork location.

64. Display the salary wise employee information for deptno 20 in descending
order

65. Display second employee record

66.Display location of employees, whose name start with A and salary between
1000 and 3000.
67.Display department name of all the employees who are reporting to Blake.

68.Display Martin's Manager's Manager's department location

69. Display the employee name and their salary who joined 2 years before the
last person hired.

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

71. Display the employee details with their location who earn maximum
commission
72. 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.

73.Display all the department names and manager who is ward's manager's
manager.

74.Display department names and maximum commission of employee's whose


salary is greater than average salary of all the clerk's

75. Display the last employee record with location.

76. Display the department number who working in sales department and they
are manager.

77. Display department name of the employee who earn minmum salary and
have reporting manager.

78. Display hiredate and Dname of all the employees working for sales
79. Display Location and Dname of employee who is working as president.
80.Display the Dname of employees whoes salary is maximum salary but lesser
than 3000

81.Display the department name who are reporting to ADAMS

82.Display last employee record.

83.Display all the employee whose salary is greater than average salary of
department 30.

84. Display the number of employees who work for research dept and their
salary is lesser than one of the salary in department in 10.

85.Display the dname that are having clerk in it.

86. Display the department names that are having atleast one L in it.

87. Display all the employees who are joined after BLAKE.

88. List the dept name that are having at least 3 employees but not more than 5
employees in it.

89.Display the location of all employees whose reporting manager salary is


greater than 2000.

90.Select the employees whose dname is having at least two 'E' in it.

91.Display ename,sal of employees who are earning more than any of the
analyst.

92. Select all the employees who are working for CHICAGO

93. Query to display employee names who is having minimum salary in


department research.
94.List the department names that are having salesman.

95. List the department names that are having at least 3 employes in it.
96.List employees from research and accounting department having atleast two
reporting.

97. Write a query to display employee name, job,dname,location of all


employees who are working as manager and works at Chicago.

98. Select ename,dname of employee who earns 2nd max salary and works for
location Dallas.

99. Write a query to display the employee information who is not taking
commission and joined company after July 83

100. List employees from sales and research department having atleast 2
reporting employees

You might also like