bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 2072. The Winner University

2072. The Winner University

Leetcode Solutions

Counting Excellent Students and Comparing Totals

  1. Use a subquery to count the number of excellent students from New York University.
  2. Use another subquery to count the number of excellent students from California University.
  3. Use a CASE statement to compare the counts from the two subqueries.
    • If New York's count is greater, return 'New York University'.
    • If California's count is greater, return 'California University'.
    • If the counts are equal, return 'No Winner'.
  4. Select the result of the CASE statement as the 'winner'.

erDiagram
    NewYork {
        int student_id PK
        int score
    }
    California {
        int student_id PK
        int score
    }

Using Common Table Expressions (CTEs) to Count Excellent Students

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...