Skip to content

Commit

Permalink
Time: 1398 ms (19.54%), Space: 0B (100.00%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
joseantoniochacon committed Oct 3, 2024
1 parent 0771add commit cabb592
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions 1341-movie-rating/1341-movie-rating.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Write your MySQL query statement below

(SELECT name AS results FROM (SELECT name, count(*) as rated_movies FROM MovieRating LEFT JOIN Users ON Users.user_id = MovieRating.user_id GROUP BY name ORDER BY rated_movies DESC, name) RATINGS LIMIT 1)
UNION ALL
(SELECT title AS results FROM (SELECT title, ROUND(AVG(rating),2) AS average_rating FROM MovieRating LEFT JOIN Movies ON Movies.movie_id = MovieRating.movie_id WHERE MONTH(created_at) = 2 AND YEAR(created_at) = 2020 GROUP BY title ORDER BY average_rating DESC, title) RATES LIMIT 1)

0 comments on commit cabb592

Please sign in to comment.