now is better than never
[Level 4][SELECT] 서울에 위치한 식당 목록 출력하기 본문
https://school.programmers.co.kr/learn/courses/30/lessons/131118?language=oracle
<Oracle>
with score as
(select inf.rest_id, round(avg(rev.review_score), 2) score
from rest_info inf join
rest_review rev
on inf.rest_id = rev.rest_id
group by inf.rest_id)
SELECT inf.rest_id, inf.rest_name, inf.food_type
, inf.favorites, inf.address
, to_char(s.score, '999.99') score
from rest_info inf join
score s
on inf.rest_id = s.rest_id
where substr(inf.address, 1, 2) = '서울'
order by s.score desc, inf.favorites desc;
- 문제
- 실행결과
근데 SCORE 출력을 저렇게 하라고 해놓고선...
그냥 to_char 안하고 s.score 해도 (숫자형이라 맨 끝에 0 지워지는데) 정답처리 되긴 함
그래도 난 너무 신경쓰여 ㅋㅋㅋㅋㅋㅋ ㅠㅠㅠ
'프로그래머스 > SQL' 카테고리의 다른 글
[LEVEL 4][JOIN] 특정 기간동안 대여 가능한 자동차들의 대여비용 구하기 (0) | 2023.05.15 |
---|---|
[LEVEL 2][String, Date] 자동차 평균 대여 기간 구하기 (0) | 2023.05.15 |
[Level 2][SELECT] 3월에 태어난 여성 회원 목록 출력하기 (SQL 날짜 월 출력) (0) | 2023.01.03 |
[Level 4][JOIN] 보호소에서 중성화한 동물 (0) | 2023.01.03 |
[Level 4][GROUP BY] 저자 별 카테고리 별 매출액 집계하기 (0) | 2023.01.03 |