Employee SQL Exercise
Employee SQL Exercise
1. Write a query in SQL to display the full name (first and last name), and salary for those employees who earn
below 6000.
2. Write a query in SQL to display the first and last_name, department number and salary for those employees
who earn more than 8000.
3. Write a query in SQL to display the first and last name, and department number for all employees whose last
name is “McEwen”.
4. Write a query in SQL to display all the information for all employees without any department number.
5. Write a query in SQL to display all the information about the department Marketing.
6. Write a query in SQL to display the full name (first and last), hire date, salary, and department number for
those employees whose first name does not containing the letter M and make the result set in ascending order by
department number.
7. Write a query in SQL to display all the information of employees whose salary is in the range of 8000 and
12000 and commission is not null or department number is except the number 40, 120 and 70 and they have been
hired before June 5th, 1987
8. Write a query in SQL to display the full name (first and last name), and salary for all employees who does not
earn any commission.
9. Write a query in SQL to display the full name (first and last), the phone number and email separated by
hyphen, and salary, for those employees whose salary is within the range of 9000 and 17000. The column
headings assign with Full_Name, Contact_Details and Remuneration respectively.
10. Write a query in SQL to display the first and last name, and salary for those employees whose first name is
ending with the letter m.
11. Write a query in SQL to display the full name (first and last) name, and salary, for all employees whose
salary is out of the range 7000 and 15000 and make the result set in ascending order by the full name.
12. Write a query in SQL to display the full name (first and last), job id and date of hire for those employees who
was hired during November 5th, 2007 and July 5th, 2009.
13. Write a query in SQL to display the the full name (first and last name), and department number for those
employees who works either in department 70 or 90
14. Write a query in SQL to display the full name (first and last name), salary, and manager number for those
employees who is working under a manager.
15. Write a query in SQL to display all the information from Employees table for those employees who was
hired before June 21st, 2002.
16. Write a query in SQL to display the first and last name, email, salary and manager ID, for those employees
whose managers are hold the ID 120, 103 or 145
17. Write a query in SQL to display all the information for all employees who have the letters D, S, or N in their
first name and also arrange the result in descending order by salary.
18. Write a query in SQL to display the full name (first name and last name), hire date, commission percentage,
email and telephone separated by '-', and salary for those employees who earn the salary above 11000 or the
seventh digit in their phone number equals 3 and make the result set in a descending order by the first name.
19. Write a query in SQL to display the first and last name, and department number for those employees who
holds a letter s as a 3rd character in their first name.
20. Write a query in SQL to display the employee ID, first name, job id, and department number for those
employees who is working except the departments 50,30 and 80.
21. Write a query in SQL to display the employee Id, first name, job id, and department number for those
employees whose department number equals 30, 40 or 90.
22. Write a query in SQL to display the ID for those employees who did two or more jobs in the past.
23. Write a query in SQL to display job ID, number of employees, sum of salary, and difference between highest
salary and lowest salary for a job.
24. Write a query in SQL to display job ID for those jobs that were done by two or more for more than 300 days.
25. Write a query in SQL to display the country ID and number of cities in that country we have.
26. Write a query in SQL to display the manager ID and number of employees managed by the manager.
27. Write a query in SQL to display the details of jobs in descending sequence on job title.
28. Write a query in SQL to display the first and last name and date of joining of the employees who is either
Sales Representative or Sales Man.
29. Write a query in SQL to display the average salary of employees for each department who gets a commission
percentage.
30. Write a query in SQL to display those departments where any manager is managing 4 or more employees.
31. Write a query in SQL to display those departments where more than ten employees work who got a
commission percentage.
32. Write a query in SQL to display the employee ID and the date on which he ended his previous job.
33. Write a query in SQL to display the details of the employees who have no commission percentage and salary
within the range 7000 to 12000 and works in that department which number is 50
34. Write a query in SQL to display the job ID for those jobs which average salary is above 8000
35. Write a query in SQL to display job Title, the difference between minimum and maximum salaries for those
jobs which max salary within the range 12000 to 18000.
36. Write a query in SQL to display all those employees whose first name or last name starts with the letter D.
1. SELECT first_name ||' '||last_name AS Full_Name, salary
FROM employees
WHERE salary < 6000;