Answer the question
In order to leave comments, you need to log in
How to calculate the average value of cells with the same place of work?
Good afternoon, the essence of the task is
to Run a query that:
- Gets the titles of positions and the average salary for the position;
- the position must be related to management, i.е. contain the word Manager;
- the average salary should not be less than 10 thousand.
I display all the necessary positions, and the salary of all people for these positions, but it is impossible to calculate the average salary. Tell me which way to go
Select jobs.job_title, employees.salary
FROM jobs, employees
Where jobs.job_title Like '%Manager' AND employees.job_id=jobs.job_id
Answer the question
In order to leave comments, you need to log in
For example like this:
SELECT
jobs.job_title,
AVG(employees.salary) average_salary
FROM
employees
JOIN jobs ON employees.job_id = jobs.job_id
WHERE
jobs.job_title Like '%Manager'
GROUP BY jobs.job_title
HAVING AVG(employees.salary) > 10000;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question