groupby

SQL GROUP BY Clause

SQL GROUP BY Clause

The GROUP BY clause is used to group rows that have the same values into summary rows, often used with aggregate functions like COUNT, SUM, AVG, etc.

Example of GROUP BY

SELECT gender, COUNT(*) AS total_users
FROM Users
GROUP BY gender;
    

This query retrieves the total number of users grouped by gender.