또 다른 쿼리를 실행해 보겠습니다.
코드 9-14
SELECT YEAR(a.release_date), a.ranks, a.movie_name,
ROUND(a.sale_amt / b. total_amt * 100, 2) percentage
FROM box_office a
INNER JOIN (SELECT YEAR(release_date) years, SUM(sale_amt) total_amt
FROM box_office
WHERE YEAR(release_date) >= 2015
GROUP BY 1
) b
ON YEAR(a.release_date) = b.years
WHERE a.ranks <= 3
ORDER BY 1, 2;
실행결과