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

LeetCode SL Medium Problem #25

Answered by iamAntimPal
IamShiwangi asked this question in Q&A
Discussion options

You must be logged in to vote
# Write your MySQL query statement below
(
 SELECT name AS results
 FROM
 Users
 JOIN MovieRating USING (user_id)
 GROUP BY user_id
 ORDER BY COUNT(1) DESC, name
 LIMIT 1
)
UNION ALL
(
 SELECT title
 FROM
 MovieRating
 JOIN Movies USING (movie_id)
 WHERE DATE_FORMAT(created_at, '%Y-%m') = '2020-02'
 GROUP BY movie_id
 ORDER BY AVG(rating) DESC, title
 LIMIT 1
);

Exxplanation

Replies: 1 comment 1 reply

Comment options

# Write your MySQL query statement below
(
 SELECT name AS results
 FROM
 Users
 JOIN MovieRating USING (user_id)
 GROUP BY user_id
 ORDER BY COUNT(1) DESC, name
 LIMIT 1
)
UNION ALL
(
 SELECT title
 FROM
 MovieRating
 JOIN Movies USING (movie_id)
 WHERE DATE_FORMAT(created_at, '%Y-%m') = '2020-02'
 GROUP BY movie_id
 ORDER BY AVG(rating) DESC, title
 LIMIT 1
);

Exxplanation

You must be logged in to vote
1 reply
Comment options

Thank You I understand that Question.

Answer selected by IamShiwangi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

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