문제: 카테고리로 가장 비싼 식품의 정보 조회하기
SELECT CATEGORY, MAX(PRICE) MAX_PRICE, PRODUCT_NAME
FROM FOOD_PRODUCT
WHERE CATEGORY IN ('과자', '국', '김치', '식용유')
GROUP BY CATEGORY
ORDER BY MAX_PRICE DESC
WHERE
+ GROUP BY
+ MAX
=> JOIN
=> ORDER BY
SELECT MP.CATEGORY, MP.MAX_PRICE, FP.PRODUCT_NAME
FROM FOOD_PRODUCT FP JOIN (
SELECT CATEGORY, MAX(PRICE) AS MAX_PRICE
FROM FOOD_PRODUCT
WHERE CATEGORY IN ('과자', '국', '김치', '식용유')
GROUP BY CATEGORY) MP
ON MP.CATEGORY = FP.CATEGORY AND MP.MAX_PRICE = FP.PRICE
ORDER BY MP.MAX_PRICE DESC