SQL GROUP BY Statement. The following SQL queries show how to use GROUP BY while querying data from database using SQL.
GROUP BY Syntax:
SELECT column, column
FROM table_name
WHERE condition
GROUP BY column
Example:
SELECT COUNT(id), country
FROM employees
GROUP BY country;