Exercise: Group by Two Columns
Count students by grade and age.
Solution
sql
1SELECT grade, age, COUNT(*) AS count
2FROM students
3GROUP BY grade, age;
Count students by grade and age.
1SELECT grade, age, COUNT(*) AS count
2FROM students
3GROUP BY grade, age;