출처: https://astrocosmos.tistory.com/202 [ASTROCOSMOS:티스토리] SQL SELECT] 서울에 위치한 식당 목록 출력하기 :: 하나둘셋넷
728x90

SQL SELECT] 서울에 위치한 식당 목록 출력하기

 

-- 코드를 입력하세요
SELECT I.REST_ID, I.REST_NAME, I.FOOD_TYPE, I.FAVORITES, I.ADDRESS, ROUND(AVG(R.REVIEW_SCORE),2) as SCORE
    FROM REST_INFO I
    INNER JOIN(
        SELECT REST_ID, REVIEW_SCORE
        FROM REST_REVIEW
        ) AS R on I.REST_ID = R.REST_ID
    WHERE I.ADDRESS LIKE "서울%"
    GROUP BY REST_ID
    ORDER BY SCORE DESC, FAVORITES DESC

 

728x90

+ Recent posts