leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1341.sql (426B)


      1 (
      2     SELECT name AS results
      3     FROM MovieRating R
      4     LEFT JOIN Users U
      5     ON R.user_id = U.user_id
      6     GROUP BY R.user_id
      7     ORDER BY COUNT(*) DESC, U.name
      8     LIMIT 1
      9 ) UNION ALL (
     10     SELECT M.title
     11     FROM MovieRating R
     12     LEFT JOIN Movies M
     13     ON R.movie_id = M.movie_id
     14     WHERE YEAR(R.created_at) = 2020 AND MONTH(R.created_at) = 2
     15     GROUP BY R.movie_id
     16     ORDER BY AVG(R.rating) DESC, M.title
     17     LIMIT 1
     18 )