BeginnerCoder

Lesson 7 — GROUP_CONCAT

GROUP_CONCAT: glue a group into one string

GROUP_CONCAT(column, separator) is an aggregate that joins all values of a group into one text, like Python's ", ".join(). To control the order inside each list, aggregate from an already-sorted subquery.

SELECT author, GROUP_CONCAT(title, ' / ')
FROM (SELECT * FROM books ORDER BY title)
GROUP BY author

Why it matters: "list all tags of a post" or "all products in an order" in a single report row.

Want it another way?
Task

Instead of counting the names, list them: one comma-separated string of names per team. Expected: each team with its sorted member names.

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.