SQL Exercises, Practice, Solution - exercises on employee Database
SQL employee Database [114 Exercise with Solution]
[An editor is available at the bottom of the page to write and execute the scripts.]
Structure of employee Database:

1. Write a query in SQL to display all the information of the employees. Go to the editor
Sample table: employees
2. Write a query in SQL to find the salaries of all employees. Go to the editor
Sample table: employees
3. Write a query in SQL to display the unique designations for the employees. Go to the editor
Sample table: employees
4. Write a query in SQL to list the emp_name and salary is increased by 15% and expressed as no.of Dollars. Go to the editor
Sample table: employees
5. Write a query in SQL to produce the output of employees name and job name as a fromat of "Employee & Job". Go to the editor
Sample table: employees
6. Write a query in SQL to produce the output of employees as follows. Go to the editor
Employee
JONAS(manager).
Sample table: employees
7. Write a query in SQL to list the employees with Hire date in the format like February 22, 1991. Go to the editor
Sample table: employees
8. Write a query in SQL to count the no. of characters with out considering the spaces for each name. Go to the editor
Sample table: employees
9. Write a query in SQL to list the emp_id,salary, and commission of all the employees. Go to the editor
Sample table: employees
10. Write a query in SQL to display the unique department with jobs. Go to the editor
Sample table: employees
11. Write a query in SQL to list the employees who does not belong to department 2001. Go to the editor
Sample table: employees
12. Write a query in SQL to list the employees who joined before 1991. Go to the editor
Sample table: employees
13. Write a query in SQL to display the average salaries of all the employees who works as ANALYST. Go to the editor
Sample table: employees
14. Write a query in SQL to display the details of the employee BLAZE. Go to the editor
Sample table: employees
15. Write a query in SQL to display all the details of the employees whose commission is more than their salary. Go to the editor
Sample table: employees
16. Write a query in SQL to list the employees whose salary is more than 3000 after giving 25% increment. Go to the editor
Sample table: employees
17. Write a query in SQL to list the name of the employees, those having six characters to their name. Go to the editor
Sample table: employees
18. Write a query in SQL to list the employees who joined in the month January. Go to the editor
Sample table: employees
19. Write a query in SQL to list the name of employees and their manager separated by the string 'works for'. Go to the editor
Sample table: employees
20. Write a query in SQL to list all the employees whose designation is CLERK. Go to the editor
Sample table: employees
21. Write a query in SQL to list the employees whose experience is more than 27 years. Go to the editor
Sample table: employees
22. Write a query in SQL to list the employees whose salaries are less than 3500. Go to the editor
Sample table: employees
23. Write a query in SQL to list the name, job_name, and salary of any employee whose designation is ANALYST. Go to the editor
Sample table: employees
24. Write a query in SQL to list the employees who have joined in the year 1991. Go to the editor
Sample table: employees
25. Write a query in SQL to list the name, id, hire_date, and salary of all the employees joined before 1 apr 91. Go to the editor
Sample table: employees
26. Write a query in SQL to list the employee name, and job_name who are not working under a manager. Go to the editor
Sample table: employees
27. Write a query in SQL to list all the employees joined on 1st may 91. Go to the editor
Sample table: employees
28. Write a query in SQL to list the id, name, salry, and experiences of all the employees working for the manger 68319. Go to the editor
Sample table: employees
29. Write a query in SQL to list the id, name, salary, and experience of all the employees who earn more than 100 as daily salary. Go to the editor
Sample table: employees
30. Write a query in SQL to list the employees who are retiring after 31-Dec-99 after completion of 8 years of service period. Go to the editor
Sample table: employees
31. Write a query in SQL to list those employees whose salary is an odd value. Go to the editor
Sample table: employees
32. Write a query in SQL to list those employees whose salary contain only 3 digits. Go to the editor
Sample table: employees
33. Write a query in SQL to list the employees who joined in the month of APRIL. Go to the editor
Sample table: employees
34. Write a query in SQL to list the employees those who joined in company before 19th of the month. Go to the editor
Sample table: employees
35. List the employees who are SALESMAN and gathered an experience which month portion is more than 10. Go to the editor
Sample table: employees
36. Write a query in SQL to list the employees of department id 3001 or 1001 joined in the year 1991. Go to the editor
Sample table: employees
37. Write a query in SQL to list the employees of department id 3001 or 1001 joined in the year 1991. Go to the editor
Sample table: employees
38. Write a query in SQL to list all the employees of designation CLERK in department no 2001. Go to the editor
Sample table: employees
39. Write a query in SQL to list the ID, name, salary, and job_name of the employees for - Go to the editor
1. Annual salary is below 34000 but receiving some commission which should not be more than the salary,
2. And designation is SALESMAN and working for department 3001.
Sample table: employees
40. Write a query in SQL to list the employees who are either CLERK or MANAGER. Go to the editor
Sample table: employees
41. Write a query in SQL to list the employees who joined in any year except the month February. Go to the editor
Sample table: employees
42. Write a query in SQL to list the employees who joined in the year 91. Go to the editor
Sample table: employees
43. Write a query in SQL to list the employees who joined in the month of June in 1991. Go to the editor
Sample table: employees
44. Write a query in SQL to list the employees whose annual salary is within the range 24000 and 50000. Go to the editor
Sample table: employees
45. Write a query in SQL to list the employees who have joined on the following dates 1st May,20th Feb, and 03rd Dec in the year 1991. Go to the editor
Sample table: employees
46. Write a query in SQL to list the employees working under the managers 63679,68319,66564,69000. Go to the editor
Sample table: employees
47. Write a query in SQL to list the employees who joined after the month JUNE in the year 1991. Go to the editor
Sample table: employees
48. Write a query in SQL to list the employees who joined in 90's. Go to the editor
Sample table: employees
49. Write a query in SQL to list the managers of department 1001 or 2001. Go to the editor
Sample table: employees
50. Write a query in SQL to list the employees, joined in the month FEBRUARY with a salary range between 1001 to 2000. Go to the editor
Sample table: employees
51. Write a query in SQL to list all the employees who joined before or after 1991. Go to the editor
Sample table: employees
52. Write a query in SQL to list the employees along with department name. Go to the editor
Sample table: employees
Sample table: department
53. Write a query in SQL to list the name, job name, annual salary, department id, department name and grade of the employees who earn 60000 in a year or not working as an ANALYST. Go to the editor
Sample table: employees
Sample table: department
Sample table: salary_grade
54. Write a query in SQL to list the name, job name, manager id, salary, manager name, manager's salary for those employees whose salary is greater than the salary of their managers. Go to the editor
Sample table: employees
55. Write a query in SQL to list the employees name, department, salary and commission. For those whose salary is between 2000 and 5000 while location is PERTH. Go to the editor
Sample table: employees
Sample table: department
56. Write a query in SQL to list the grade, employee name for the department id 1001 or 3001 but salary grade is not 4 while they joined the company before 1992-12-31. Go to the editor
Sample table: employees
Sample table: salary_grade
57. Write a query in SQL to list the employees whose manager name is JONAS. Go to the editor
Sample table: employees
58. Write a query in SQL to list the name and salary of FRANK if his salary is equal to max_sal of his grade. Go to the editor
Sample table: employees
Sample table: salary_grade
59. Write a query in SQL to list the employees who are working either MANAGER or ANALYST with a salary range between 2000 to 5000 without any commission. Go to the editor
Sample table: employees
60. Write a query in SQL to list the id, name, salary, and location of the employees working at PERTH,or MELBOURNE with an experience over 10 years. Go to the editor
Sample table: employees
Sample table: department
61. Write a query in SQL to list the employees along with their location who belongs to SYDNEY, MELBOURNE with a salary range between 2000 and 5000 and joined in 1991. Go to the editor
Sample table: employees
Sample table: department
62. Write a query in SQL to list the employees with their location and grade for MARKETING department who comes from MELBOURNE or PERTH within the grade 3 to 5 and experience over 5 years. Go to the editor
Sample table: employees
Sample table: salary_grade
Sample table: department
63. Write a query in SQL to list the employees who are senior to their own manager. Go to the editor
Sample table: employees
64. Write a query in SQL to list the employee with their grade for the grade 4. Go to the editor
Sample table: employees
Sample table: salary_grade
65. Write a query in SQL to list the employees in department PRODUCTION or AUDIT who joined after 1991 and they are not MARKER or ADELYN to their name. Go to the editor
Sample table: employees
Sample table: department
Sample table: salary_grade
66. Write a query in SQL to list the employees in the ascending order of their salaries. Go to the editor
Sample table: employees
67. Write a query in SQL to list the details of the employees in ascending order to the department_id and descending order to the jobs. Go to the editor
Sample table: employees
68. Write a query in SQL to display all the unique job in descending order. Go to the editor
Sample table: employees
69. Write a query in SQL to list the id, name, monthly salary, daily salary of all the employees in the ascending order of their annual salary. Go to the editor
Sample table: employees
70. Write a query in SQL to list the employees in descending order who are either 'CLERK' or 'ANALYST'. Go to the editor
Sample table: employees
71. Write a query in SQL to display the location of CLARE. Go to the editor
Sample table: employees
Sample table: department
72. Write a query in SQL to list the employees in ascending order of seniority who joined on 1-MAY-91,or 3-DEC-91, or 19-JAN-90. Go to the editor
Sample table: employees
73. Write a query in SQL to list the employees who are drawing the salary less than 1000 and sort the output in ascending order on salary. Go to the editor
Sample table: employees
74. Write a query in SQL to list the details of the employees in ascending order on the salary. Go to the editor
Sample table: employees
75. Write a query in SQL to list the employees in ascending order on job name and descending order on employee id. Go to the editor
Sample table: employees
76. Write a query in SQL to list the unique jobs of department 2001 and 3001 in descending order. Go to the editor
Sample table: employees
77. Write a query in SQL to list all the employees except PRESIDENT and MANAGER in ascending order of salaries. Go to the editor
Sample table: employees
78. Write a query in SQL to list the employees in ascending order of the salary whose annual salary is below 25000. Go to the editor
Sample table: employees
79. Write a query in SQL to list the employee id, name, annual salary, daily salary of all the employees in the ascending order of annual salary who works as a SALESMAN. Go to the editor
Sample table: employees
80. Write a query in SQL to list the employee id, name, hire_date, current date and experience of the employees in ascending order on their experiences. Go to the editor
Sample table: employees
81. Write a query in SQL to list the employees in ascending order of designations of those, joined after the second half of 1991. Go to the editor
Sample table: employees
82. Write a query in SQL to list the total information of employees table along with department, and location of all the employees working under FINANCE and AUDIT in the ascending department no. Go to the editor
Sample table: employees
Sample table: department
83. Write a query in SQL to display the total information of the employees along with grades in ascending order. Go to the editor
Sample table: employees
Sample table: salary_grade
84. Write a query in SQL to list the name, job name, department, salary, and grade of the employees according to the department in ascending order. Go to the editor
Sample table: employees
Sample table: department
Sample table: salary_grade
85. Write a query in SQL to list the name, job name, salary, grade and department name of employees except CLERK and sort result set on the basis of highest salary. Go to the editor
Sample table: employees
Sample table: department
Sample table: salary_grade
86. Write a query in SQL to list the employee ID, name, salary, department, grade, experience, and annual salary of employees working for department 1001 or 2001. Go to the editor
Sample table: employees
Sample table: department
Sample table: salary_grade
87. Write a query in SQL to list the details of the employees along with the details of their departments. Go to the editor
Sample table: employees
Sample table: department
88. Write a query in SQL to list the employees who are senior to their own MANAGERS. Go to the editor
Sample table: employees
89. Write a query in SQL to list the employee id, name, salary, and department id of the employees in ascending order of salary who works in the department 1001. Go to the editor
Sample table: employees
90. Write a query in SQL to find the highest salary from all the employees. Go to the editor
Sample table: employees
91. Write a query in SQL to find the average salary and average total remuneration(salary and commission) for each type of job. Go to the editor
Sample table: employees
92. Write a query in SQL to find the total annual salary distributed against each job in the year 1991. Go to the editor
Sample table: employees
93. Write a query in SQL to list the employee id, name, department id, location of all the employees. Go to the editor
Sample table: employees
Sample table: department
94. Write a query in SQL to list the employee id, name, location, department of all the departments 1001 and 2001. Go to the editor
Sample table: employees
Sample table: department
95. Write a query in SQL to list the employee id, name, salary, grade of all the departments 1001 and 2001. Go to the editor
Sample table: employees
Sample table: salary_grade
96. Write a query in SQL to list the manager no and the number of employees working for those managers in ascending order on manager id. Go to the editor
Sample table: employees
97. Write a query in SQL to display the number of employee for each job in each department. Go to the editor
Sample table: employees
98. Write a query in SQL to list the department where at least two employees are working. Go to the editor
Sample table: employees
99. Write a query in SQL to display the Grade, Number of employees, and maximum salary of each grade. Go to the editor
Sample table: employees
Sample table: salary_grade
100. Write a query in SQL to display the department name, grade, no. of employees where at least two employees are working as a SALESMAN. Go to the editor
Sample table: employees
Sample table: department
Sample table: salary_grade
101. Write a query in SQL to list the no. of employees in each department where the no. is less than 4. Go to the editor
Sample table: employees
102. Write a query in SQL to list the name of departments where atleast 2 employees are working in that department. Go to the editor
Sample table: employees
Sample table: department
103. Write a query in SQL to check whether all the employees numbers are indeed unique. Go to the editor
Sample table: employees
104. Write a query in SQL to list the no. of employees and average salary within each department for each job name. Go to the editor
Sample table: employees
105. Write a query in SQL to list the names of those employees starting with 'A' and with six characters in length. Go to the editor
Sample table: employees
106. Write a query in SQL to list the employees whose name is six characters in length and third character must be 'R'. Go to the editor
Sample table: employees
107. Write a query in SQL to list the name of the employee of six characters long and starting with 'A' and ending with 'N'. Go to the editor
Sample table: employees
108. Write a query in SQL to list the employees who joined in the month of which second character is 'a'. Go to the editor
Sample table: employees
109. Write a query in SQL to list the employees whose names containing the character set 'AR' together. Go to the editor
Sample table: employees
110. Write a query in SQL to list the employees those who joined in 90's. Go to the editor
Sample table: employees
111. Write a query in SQL to list the employees whose ID not starting with digit 68. Go to the editor
Sample table: employees
112. Write a query in SQL to list the employees whose names containing the letter 'A'. Go to the editor
Sample table: employees
113. Write a query in SQL to list the employees whose name is ending with 'S' and six characters long. Go to the editor
Sample table: employees
114. Write a query in SQL to list the employees who joined in the month having char 'A' at any position. Go to the editor
Sample table: employees
Practice Online
Structure of employee Database:

SQL: Interview question/Tips of the Day
Parts of SQL
- DRL: Data Retrieval Language
- DML: Data Manipulation Language
- DDL: Data Definition Language
- DCL: Data Control Language
- TCL: Transaction Control Language
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- React - JavaScript Library
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework