Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5ab0fed

Browse files
committed
배수빈: [SQL] Movie Rating_241206
1 parent a7fc347 commit 5ab0fed

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎SQL/13주차/SB_Movie Rating.sql‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Write your MySQL query statement below
2+
-- 가장 많은 수의 영화를 평가한 사용자의 이름을 찾으세요. 동점일 경우, 사전학적으로 더 작은 사용자 이름을 반환하십시오.
3+
-- 2020 2월 평균 평점이 가장 높은 영화 이름을 찾아라. 동점일 경우, 사전학적으로 더 작은 영화 이름을 반환하십시오.
4+
5+
(SELECT u.name AS results
6+
FROM MovieRating m
7+
JOIN Users u ON m.user_id = u.user_id
8+
GROUP BY u.user_id
9+
ORDER BY COUNT(u.user_id) DESC, u.name
10+
LIMIT 1)
11+
UNION ALL
12+
(SELECT m.title AS results
13+
FROM MovieRating r
14+
JOIN Movies m ON r.movie_id = m.movie_id
15+
WHERE DATE_FORMAT(r.created_at, '%Y-%m') = "2020-02"
16+
GROUP BY r.movie_id
17+
ORDER BY AVG(r.rating) DESC, m.title
18+
LIMIT 1)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /