Exercise: List Names by Grade
List all names in each grade.
Solution
sql
1SELECT grade, GROUP_CONCAT(name, ', ') AS students
2FROM students
3GROUP BY grade;
List all names in each grade.
1SELECT grade, GROUP_CONCAT(name, ', ') AS students
2FROM students
3GROUP BY grade;