SQL Practice Questions
SQL Practice Questions
SQL Practice Questions
23. If all the employees not receiving commission is entitles to a bonus of Rs. 250/show the net earnings of all the employees.
24. Find all the employees whose total earning is greater than 2000/- .
25. Find all the employees whose names begin with M.
26. Find all the employees whose names end with M.
27. Find all the employees whose names contain the letter M in any case.
28. Find all the employees whose names are 5 character long.
29. Find all the employees have letter R as 3rd character of their names.
30. Find all the employees who were hired in the month of February (of any year).
31. Find all the employees who were hired on last day of the month.
32. Find all the employees who were hired more than 2 years ago.
33. Find the managers hired in the year 2003.
34. Display the names and jobs of all the employees separated by a space.
35. Display the names of all the employees with only initial letter in capital.
36. Display the names of all the employees right aligning them to 15 characters.
37. Display the names of all the employees padding them to the right up to 15
characters with *.
38. Display the length of all employee names.
39. Display the names of all the employees containing upto 20 characters.
40. Display the names of all the employees without any leading A.
41. Display the names of all the employees without any trailing R.
42. Show the first 3 characters of the names of all the employees.
43. Show the last 3 characters of the names of all the employees.
44. Display the names of all the employees whose names have an A.
45. Display the names of all the employees replacing A with a.
46. Display the names of all the employees and position where the string AR occurs
in the name.
47. Show the salary of all the employees , rounding it to the nearest Rs. 1000/-.
48. Show the salary of all the employees , ignoring the fraction less than Rs.
1000/-.
49. Show the daily salary of all the employees assuming the month to have 30 days.
50. Show the daily salary of all the employees assuming the month to have 30 days
ignoring the fraction of rupees.
51. Show the names of all the employees and date on which they completed 3 years
of service.
52. For each employee, display the no. of days passed since the employee joined the
company.
53. For each employee, display the no. of months passed since the employee joined
the company.
54. Display the details of all the employees sorted on the names.
55. Display the names of the employees, based on the tenure with the oldest
employee coming first.
56. Display the names, jobs and salaries of employees, sorting on job and salary.
57. Display the names, jobs and salaries of employees, sorting on job and within job
sorted on descending order of salary.
58. Display the names, jobs and salaries of employees, sorting on descending order
of job and within job sorted on salary.
59. List the employee names and department names of all analysts.
60. List the employee names, department names and salary for those employees who
have completed 1 year of service.
61. List the employee names, department names and salary for those employees who
are not earning any commission. Sort your output in the order of department
name.
62. 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.
63. List all the department names along with the names of employees in them ,
irrespective of the fact whether any employee is there or not.
64. List all the department names along with the names of managers in them ,
irrespective of the fact whether any manager is there or not.
65. Find names, job and salaries of all employees and also his immediate boss.
66. Find the names of those employees who earn more than their boss.
67. Find all the employees who are senior to their bosses.
68. Find the names of those employees whose immediate boss is in different
department.
69. List all the employee names along with the names of their bosses, irrespective
of the fact whether any employee has boss or not.
70. List department number and pair of employees working in the same department.
71. Display highest, lowest, sum and average salary of all the employees. Round your
result to whole numbers.
72. Display highest, lowest, sum and average salary for each job.
73. Display number of people with the same job.
74. Display number of bosses without listing them.
75. Display the difference between the highest and lowest salary.
76. Display department name and the difference between the highest and lowest
salary for that department.
77. Display department name and average salary for that department. Include only
those employees who have joined after 1st July 2001.
78. Display the boss and the salary of lowest paid employee for him. Dont include
minimum salary below Rs. 1000/-.
79. Display department name, location name, no. of people working there and
average salary. Round average salary to 2 decimal places.
80. Count distinct salary figures and number of employees receiving it.
81. Find all the department details in which at least one employee is working.
99. List employees who earn salary higher than the highest salary of clerks.
100.
List employees whose salary higher than the average salary of employees in
Display the names of employees who are earning minimum and maximum
Find out top 4 salaries of the company. Display their rank as well
103.
Find out earliest 3 employees who have joined the company. Display their
rank as well.
104.
105.
Display ename, department name and grade of each employee who joined the
Display each deprtment name and the first employee who joined that
department.
107.
108.
Display employees who joined in the last month(1st day of last month Last
How much more salary does each person need to earn to go in the next
grade?
110.
111.
112.
Display employees who are earning salary more than the average salary of
Display employees who are in that same grade as Miller and do not belong to
How many employees are there between the highest grade of a clerk and the
116.
List analysts and clerks who are either staying at Chicago or Boston and in
Display department name, grade, Max salary offered to each grade at each
department.
118.
Whos earning the best salary in each grade and where do they live?
119.
Display the locations where total salary of grade 3 employees is greater than
Display grade, highest salary in that grade and lowest salary in that grade.
121.
Display location, highest salary in that location and lowest salary in that
location.
122.
Display the department names where every employee is earning more than
2000.
123.
Set 2
1. Find out the SELLING COST AVERAGE for packages developed in JAVA.
2. Display the NAMES and AGES of all the programmers.
3. Display the NAMES of those who have done the DAP course.
4. What is the HIGHEST number of copies sold by a package?
5. Display the NAMES and DATE OF BIRTH of all the programmers born in
JANUARY.
6. Display the LOWEST course fee.
7. How many programmers have done the PGDCA course.
8. How much revenue has been earned through sale of packages in C?
9. Display the details of the SOFTWARE developed by RAMESH.
10. How many programmers studied at SABHARI?
11. Display the details of PACKAGES whose sales CROSSED the 200000 MARK.
12. .Find out the NUMBER OF COPIES, which should be sold in order to recover
the DEVELOPMENT COST of each package.
13. Display the details of packages for WHICH development cost has not been
recovered.
14. What is the price of the costliest software development in VB?
15. How many packages were developed in SQL?
16. How many programmers paid 5000 to 10000 for their COURSE?
17. What is the AVERAGE course fee?
18. Display the DETAILS of programmers knowing C.
19. How many programmers know either COBOL or JAVA?
20.How many programmers DON'T know JAVA & C both?
21. How old is the OLDEST male Programmers?
22.Who is the OLDEST male Programmers?
23.What is the AVERAGE age of female programmers?
24.Calculate the experience in years for each programmers and display along with
the names in descending order.
25.Who are the programmers who celebrate their Birthday's during the CURRENT
MONTH.
26.How many female programmers are there?
27.What are the languages known by the male programmers.
28.What is the AVERAGE salary?
29.How many people draw 30000 to 40000?
30.Display the details of those WHO DON'T know ASP, COBOL or JAVA.
31. How many FEMALE programmers knowing C are above 34 years of age?
32.33. Display the details of those with LESS than a year's EXPERIENCE.
33.Display the details of those who will be COMPLETING 10 years of service this
year.
101.
102.
103.
104.
Display names of packages, WHICH have been sold LESS THAN the
Who are the authors of packages, WHICH have recovered MORE THAN
EACH language?
107.
109.
110.
111.
112.
113.
114.
Who are the male programmers earning BELOW the AVERAGE salary of
female programmers?
115.
Who are the female programmers earning MORE than the HIGHEST paid
male programmers?
116.
Display the details of THOSE WHO are drawing the same salary?
117.
119.
120.
PREGATHI?
121.
Display the details of the software that was developed by male programmers
Display the details of the software that was developed in the language that
Display the details of software that was developed in the language which is
127.
Display the names of programmers WHO HAVE NOT developed any package?
128.
APPLE?
129.
130.
131.
132.
In which institute did the person who developed the COSTLIEST package
study?
133.
Which language listed in profl and prof2 HAS NOT BEEN used to develop
any package?
134.
How much does the person WHO developed the HIGHEST selling package
How many months' will it take for each programmer to recover the cost of
experience?
137.
What is the AVERAGE salary for those WHOSE software's sales value is
How many packages were developed by the students who studied in the
How many packages were developed by the person WHO developed the
from BDPS ?
142.
List the programmers (from software table) and institutes they studied,
List each profit with the number of programmers having that profl and the
EACH developed?
145.
List all the details of programmers who has done a course at S.S.I.L?
146.
147.
Display the institutes from where every programmer has developed at least
2 softwares
148.
Select programmers for whom every title they have developed is the best
149.
Display the language in which not a single programmer from Shabari has
developed a software.