SQL Questions
SQL Questions
15. Retrieve the employees whose first name starts with 'J'.
16. Retrieve the employees whose last name ends with 'son'.
19. Retrieve the employees who do not work in the Engineering department.
20. Retrieve the employees hired in the month of January.
-----------------------------------X----------------------------------
X------------------------
1. Retrieve all employee records sorted by their hire date in descending order.
2. List the first names of employees in ascending order, limiting the results to
the top 10.
3. How many employees work in each department?
4. What is the highest salary in the Engineering department?
5. Find the total number of employees who were hired before 2019.
6. Which department has the lowest average salary?
7. List all distinct job departments from the Employees table.
8. Count the total number of unique first names in the Employees table.
9. Identify the employee with the third highest salary.
10. How many employees have a first name that contains the letter "a"?
11. List the names of employees who do not have the letter "e" in their first
names.
12. What is the average salary of all employees, excluding the highest earner?
13. Retrieve the details of employees whose salary is above the company average.
14. How many employees were hired on the last day of any month?
15. Which year saw the highest number of employees being hired?
16. List the employees whose names start with "J" and end with "n".
17. Retrieve the total salary paid to employees in the Marketing department.
18. Find employees whose last names are at least 5 characters long.
19. What is the difference in salary between the highest and lowest paid employees?
20. How many employees have a salary within the top 10% of the company?
SELECT department
FROM employees
WHERE department IN (
SELECT DISTINCT department
FROM employees
WHERE salary < 60000
);