The answer to the chapter is as shown below, can someone explain me how does the "a.sale_price part" works? Thanks in advance!
SELECT id, avg(a.sale_price) FROM (
SELECT id, sale_price FROM order_items
SELECT id, sale_price FROM order_items_historic) AS a
GROUP BY 1;
Replace this line with your code.