47 모든 레코드 조회하기
SELECT *
FROM ANIMAL_INS
ORDER BY ANIMAL_ID
48 즐겨찾기가 가장 많은 식당 정보 출력하기
SELECT FOOD_TYPE, REST_ID, REST_NAME, FAVORITES
FROM
(SELECT *
FROM REST_INFO
GROUP BY REST_NAME
ORDER BY FAVORITES DESC) A
GROUP BY FOOD_TYPE
ORDER BY FOOD_TYPE DESC
49 식품분류별 가장 비싼 식품의 정보 조회하기
SELECT CATEGORY, PRICE, PRODUCT_NAME
FROM
(
SELECT *,
RANK() OVER(PARTITION BY CATEGORY ORDER BY PRICE DESC) RANKING
FROM FOOD_PRODUCT
WHERE CATEGORY IN ('과자', '국', '김치', '식용유')
) A
WHERE RANKING=1
ORDER BY PRICE DESC