INTERACTIVE LECTURES
Summarize and compare
Guided class activity · apply the ideas from the full SQL lessons.
Open the detailed lessons for this activity
Detailed lessons in this module
Open the full explanations, examples, and SQL exercises directly.
Opening your saved work…
Sign in to save across devices → · Download your guest work before switching accounts.
Choose the unit of your summary
Step 3 of 4 · Database: Northshore Coffee
READ & UNDERSTAND
GROUP BY creates one result group for each distinct grouping value. Grouping by category answers a category-level question; grouping by category and size creates a finer comparison.
Every selected non-aggregate value should describe the group unambiguously. SQLite can accept a bare column outside GROUP BY, but acceptance does not make an arbitrary item name a meaningful label for a category average.
Worked example
SELECT category, COUNT(*) AS items, ROUND(AVG(price), 2) AS average_price FROM menu_items GROUP BY category ORDER BY category;
Each category becomes one group. COUNT counts its menu rows and AVG summarizes their prices; the result is ordered by category so teams can compare it consistently.
The average is per menu item in this fixture, not weighted by purchases. You cannot describe it as the average price customers paid without appropriate order-item data.
Your question
Return category and COUNT(*) AS item_count for each category, ordered by category.
Explain your evidence
If you add size to GROUP BY, why might the number of result rows increase?
Try a query to unlock the worked-answer discussion.
Query results
Predict the result, then run your query.Predict the result, then run your query.
Read-only activity · One statement per run · First 200 rows displayed · Checks compare the complete bounded result, not just this preview.
Explore this query freely in the playground ↗Check the save status above. Account-saved work is available in My Progress. Explanations are for discussion, not automatically graded. No prerequisite locks.