Employees SQL Exercises
Support
Script
Exercises
-
List all employees and their departments. (employee_name, department_name)
-
List all departments and their directors. (department_name, director_name)
-
List all projects and the department to which they belong. (project_name, department_name)
-
What projects are controlled by the department number 1. (project_name)
-
What projects are controlled by the Transports department. (project_name)
-
List all employees working on project XPTO and how many hours each one of them works in that project. (employee_name, hours)
-
List all employees working on project XPTO and how many hours each one of them works in that project. Order the list from the employee that works more hours to the one that works less. (employee_name, hours)
-
How many employees work in each project? (project_name, number)
-
How many hours are spent weekly in each project? (project_name, hours)
-
How many hours does each employee spends on projects every week? (employee_name, hours)
-
List all employees and their superiors. (employee_name, superior_name)
-
List all employees and their superiors. If the employee does not have a superior list it anyway with a NULL superior. (employee_name, superior_name)
-
What is the largest salary in each department? (department_name, salary)
-
What is the highest salary in the whole company? (salary)
-
What is the difference between the highest and lowest salaries in the company? (difference)
-
What is the salary difference between each employee and his superior? (employee_name, superior_name, difference)
-
What is the biggest difference between the salary of an employee and his superior? (difference)
-
List the departments where the average salary is more than 1300 euros? (department_name)
-
List the employees who work on projects external to their department? (employee_name)
-
List the employees who work on projects internal to their department? (employee_name)
-
List the employees who only work on projects internal to their department? (employee_name)