Resumen de la lección · Video de 8 min
Summarizing like a pivot table: GROUP BY with COUNT, SUM and AVG
It's Monday morning, and your manager asks a simple question. How much did each product category sell, and how many orders did each one get? In Excel, you'd reach for a pivot table. You'd drag Category into Rows and drag Amount into Values. Then you'd drag Amount into Values a second time and set that copy to Count. That works well, until the data has half a million rows, or you have to rebuild the same pivot every week.
Ideas clave
- COUNT(*) counts rows
- SUM adds up, AVG averages
- Result: 8 orders, 232 total, 29 average
Abrir la lección completa Ver el curso
Preguntas y respuestas
What is Summarizing like a pivot table: GROUP BY with COUNT, SUM and AVG about?
It's Monday morning, and your manager asks a simple question. How much did each product category sell, and how many orders did each one get? In Excel, you'd reach for a pivot table. You'd drag Category into Rows and drag Amount into Values. Then you'd drag Amount into Values a second time and set that copy to Count. That works well, until the data has half a million rows, or you have to rebuild the same pivot every week.
What are the key points of Summarizing like a pivot table: GROUP BY with COUNT, SUM and AVG?
COUNT(*) counts rows. SUM adds up, AVG averages. Result: 8 orders, 232 total, 29 average.
How can I practise Summarizing like a pivot table: GROUP BY with COUNT, SUM and AVG?
Watch the lesson, read it, then answer its quiz in the course "Practical SQL for Analysts".