[ํ๋ก๊ทธ๋๋จธ์ค] ์์ธ์ ์์นํ ์๋น ๋ชฉ๋ก ์ถ๋ ฅํ๊ธฐ | ์ค๋ผํด
ยท
๐ Coding Test/SQL
๋ฌธ์ ์๋์ฐจ ๋์ฌ ๊ธฐ๋ก ๋ณ ๋์ฌ ๊ธ์ก ๊ตฌํ๊ธฐํ์ดSELECT A.REST_ID, A.REST_NAME, A.FOOD_TYPE, A.FAVORITES, A.ADDRESS, B.REVIEW_SCOREFROM REST_INFO A JOIN (SELECT REST_ID, ROUND(AVG(REVIEW_SCORE), 2) REVIEW_SCORE FROM REST_REVIEW GROUP BY REST_ID) BON A.REST_ID = B.REST_IDWHERE A.ADDRESS LIKE '์์ธ%'ORDER BY REVIEW_SCORE DESC, FAVORITES DESC;REST_ID์ ๋ฆฌ๋ทฐ์ ์ ํ๊ท ๋ ๊ฐ์ ์ปฌ๋ผ์ ๊ฐ๋ ์ธ๋ผ์ธ ๋ทฐ๋ฅผ ๋ง๋ค์ด ์กฐ์ธํ์ฌ ํ์ดํ์์ต๋๋ค.