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

sehyunny·2023년 6월 28일
0

코딩테스트

목록 보기
7/11

https://school.programmers.co.kr/learn/courses/30/lessons/131118

조회할 데이터 : 식당ID, 식당 이름, 음식 종류, 즐겨찾기 수, 주소, 리뷰 평균 점수
조건1. 서울에 위치
조건2. 리뷰 평균점수는 소수점 세번째 자리에서 반올림
조건3. 결과는 평균점수를 기준으로 내림차순 정렬, 평균점수가 같다면 즐겨찾기 수를 기준으로 내림차순 정렬

SELECT rest_info.rest_id,
       rest_info.rest_name,
       rest_info.food_type,
       rest_info.favorites,
       rest_info.address,
       ROUND(AVG(rest_review.review_score), 2) AS score
FROM rest_info 
     INNER JOIN rest_review ON rest_info.rest_id = rest_review.rest_id
WHERE rest_info.address LIKE '서울%'
GROUP BY rest_info.rest_id
ORDER BY score DESC, rest_info.favorites DESC

☑️ 헤맨 부분
'%서울%'이 아닌, '서울%'로 입력해야 정답처리 되었음

0개의 댓글