DrSchool Learn coding, fast.
EN AR BN CS DE EL Search

SQL: GROUP BY

Learn GROUP BY in SQL with practical examples.

Read time: 1 min Words: 64
Open Playground → SQL My Progress

SQL — GROUP BY

Overview

Learn GROUP BY in SQL with a clear explanation and a practical example.

What you'll learn

  • What GROUP BY means
  • When to use it
  • How it works in practice
  • A copy‑paste example

Syntax

GROUP BY

Example

SELECT country, COUNT(*) AS users
FROM users
GROUP BY country
ORDER BY users DESC;

Notes

  • Test the example in the Playground.
  • Start simple, then expand.

Mistakes

  • Mixing up the syntax.
  • Not testing the output.

Try: Open the Playground: /en/playground/sql