This shows you the differences between two versions of the page.
ewis:laboratoare:06 [2023/04/12 18:00] alexandru.predescu [Exercises] |
ewis:laboratoare:06 [2023/04/12 18:01] (current) alexandru.predescu [Exercises] |
||
---|---|---|---|
Line 504: | Line 504: | ||
- Using aggregate functions, write an SQL query to calculate the average salary in the company database. | - Using aggregate functions, write an SQL query to calculate the average salary in the company database. | ||
- Write an SQL query to return a list of employees with the following information about them: | - Write an SQL query to return a list of employees with the following information about them: | ||
- | * the name | + | * the name |
- | * the name of their department | + | * the name of their department |
- | * the size of their team (number of employees within the same department) | + | * the size of their team (number of employees within the same department) |
- Write an SQL query to return a list of employees with the following information about them: | - Write an SQL query to return a list of employees with the following information about them: | ||
- | * the name | + | * the name |
- | * the name of their position | + | * the name of their position |
- | * the min/average/max salary of the employees on the same position | + | * the min/average/max salary of the employees on the same position |
- Write an SQL query to return a list of employees with the following information about them: | - Write an SQL query to return a list of employees with the following information about them: | ||
- | + | * the name in uppercase | |
- | * the name in uppercase | + | * the location of their department |
- | * the location of their department | + | |
- Write an SQL query to return a list of employees (name, salary) having a higher salary than the average salary within the company. | - Write an SQL query to return a list of employees (name, salary) having a higher salary than the average salary within the company. | ||
- | |||
- Write an SQL query to return a list of employees (name, salary) having a higher salary than their manager. | - Write an SQL query to return a list of employees (name, salary) having a higher salary than their manager. | ||
- | |||
- Write an SQL query to return the employees (name, salary) having the highest salary within each department. | - Write an SQL query to return the employees (name, salary) having the highest salary within each department. | ||
- | |||
- Write an SQL query to return the managers and the number of employees in their teams. | - Write an SQL query to return the managers and the number of employees in their teams. | ||
- | |||
- Write an SQL query to list all employees and the year they were hired (hint: use the scalar function DATE_FORMAT(hire_date,'%Y')) | - Write an SQL query to list all employees and the year they were hired (hint: use the scalar function DATE_FORMAT(hire_date,'%Y')) | ||