SQL Knowledge Center · About ·
Easy Interactive Online SQL Training for Beginners

SQL GROUP BY Tutorial - Aggregate Data Queries

Lesson 17 of 31

GROUP BY

Interactive SQL Tutorial

You can use aggregate functions such as COUNT, SUM, AVG, MAX, and MIN with the GROUP BY clause.

When you GROUP BY something, you split the table into different piles based on the value of each row.

For example,
SELECT COUNT(*), species FROM friends_of_pickles GROUP BY species; would return the number of rows for each species.

Can you return the tallest height for each species? Remember to return the species name next to the height too, like in the example query.

SQL:

Query Result:

Available Tables: