SQL Taskbook Level 7.5
The tables are given:
| id | name | salary | years_experience | department_id |
|---|---|---|---|---|
| 1 | John | 1300 | 1 | 1 |
| 2 | Sam | 300 | 0 | 3 |
| 3 | Jorge | 4300 | 5 | 2 |
| 4 | Peter | 3000 | 2 | 4 |
| 5 | Andrew | 1500 | 3 | 2 |
| 6 | Mark | 800 | 0 | 1 |
| 7 | Donald | 2400 | 2 | 4 |
| 8 | Evans | 1900 | 2 | 4 |
| 9 | Max | 5500 | 8 | 2 |
| 10 | Erick | 1200 | 1 | 3 |
| id | department_id | income_per_year |
|---|---|---|
| 1 | 3 | 95000 |
| 2 | 2 | 110000 |
| 3 | 4 | 95000 |
| 4 | 1 | 100000 |
| id | name |
|---|---|
| 1 | Ruby |
| 2 | PHP |
| 3 | Vue.js |
| 4 | React |
Solve the following tasks for them:
Select a department name and a label for it. If the department's profit for the year is more than 90000 then the label 'Normal department' If the department's profit for the year is more than 95000 also the salary that employees from this department receive for the year should not be more than 50000 then the label 'Good department' If the department's profit for the year is more than 100000 also the salary that employees from this department receive for the year should not be more than 50000 and the number of years of experience of employees is not less than 10 years then the label 'The best department' Otherwise 'Average department'