알고리즘

[프로그래머스] 서울에 위치한 식당 목록 출력하기

HHB 2023. 10. 9. 19:15
-- 코드를 입력하세요
SELECT A.REST_ID, B.REST_NAME, B.FOOD_TYPE, B.FAVORITES, B.ADDRESS, ROUND(AVG(REVIEW_SCORE), 2) AS SCORE 
FROM REST_REVIEW A
INNER JOIN (SELECT REST_ID, REST_NAME, FOOD_TYPE, FAVORITES, ADDRESS
FROM REST_INFO
WHERE SUBSTR(ADDRESS, 1, 2) = '서울') B ON A.REST_ID = B.REST_ID
GROUP BY 1
ORDER BY SCORE DESC , B.FAVORITES DESC
728x90
반응형
LIST