Skip to content

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

You must be logged in to vote
1 reply
@IamShiwangi
Comment options

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
2 participants