MySQL/tasks/aggregators.sql

12 lines
421 B
MySQL
Raw Normal View History

USE tutorial;
SELECT count(annualSalaryGrossEUR_Amount) FROM Employee;
SELECT sum(annualSalaryGrossEUR_Amount) FROM Employee;
SELECT avg(annualSalaryGrossEUR_Amount) FROM Employee;
SELECT Department.name, round(avg(annualSalaryGrossEUR_Amount), 2) AS salary
FROM Employee
LEFT JOIN Department ON Employee.departmentId = Department.id
GROUP BY departmentId
HAVING salary > 48000
ORDER BY salary DESC;