Find the most popular course
Warm-up · aggregation, joins, filtering
Given 3 tables, students(id, name), courses(id, name), grades(id, course_id, student_id, grade),
find the name of the most popular course: the one with the most enrolled students who are
passing, i.e. scored a grade of at least 50. If there is a tie, return the course name that is
lexicographically smaller. Output the column (name).
Expected columns
name
Hints
Hint 1 — filter, then count
Keep only grades >= 50 in WHERE, then GROUP BY the course and COUNT(*) the passing students per course.
Hint 2 — the students table
Each grades row already is one enrolled student. Joining students adds a lookup per row without changing any count.