Instruction
That's right!
Let's study one more example of this kind:
SELECT customer_id, AVG(total_sum) FROM orders WHERE order_date >= '2019-01-01' AND order_date < '2020-01-01' GROUP BY customer_id;
As you can see, we now use the function AVG(total_sum) which will count the average order value for each of our customers but only for their orders placed in 2019.
Exercise
For each department find the average salary in 2015.
Stuck? Here's a hint!
Type:
SELECT department, AVG(salary) FROM employees WHERE year = 2015 GROUP BY department;



