Topfolio
Career TracksMicro Free CoursesTask CoursesPracticeInterview PracticeWork ExperienceProjects
Career TrackBlog
Support
Dashboard
Career TracksMicro Free CoursesTask Courses
SQL & Python
Interview Prep
Work ExperienceProjectsResume Feedback
CertificatesMy OrdersRefer & Earn
Join Community

Navigation

Dashboard
Learn
Career TracksMicro Free CoursesTask Courses
Practice
SQL & PythonInterview Prep
Career
Work ExperienceProjectsResume Feedback
My Stuff
CertificatesMy OrdersRefer & Earn
Join Community
Topfolio

Learn data analytics online. Real skills, real projects, real community.

courses

  • Career Tracks
  • Work Experience
  • Best Data Analyst Course in India
  • SQL Fundamentals
  • SQL Advanced
  • Python for Data
  • Micro Free Courses

practice

  • SQL Fundamentals Interview Test
  • SQL Advanced Coding Test
  • All Practice Tests

resources

  • How to Become a Data Analyst
  • SQL Interview Questions
  • Data Analyst Salary Guide
  • Free Datasets for Practice
  • SQL vs NoSQL Guide
  • Data Analyst vs Data Engineer vs Data Scientist

employers

  • Enterprise Screening
  • AI Proctoring Demo
  • Volume Pricing
  • Employer Portal

company

  • About
  • Terms
© 2026 Topfolio. All rights reserved.Made with ❤️ for aspiring analysts
  1. Home
  2. /
  3. Practice
  4. /
  5. SQL Aggregation and GROUP BY

SQL Aggregation and GROUP BY Practice Questions

Aggregation collapses many rows into one summary row per group: GROUP BY names the grouping columns, and SUM, COUNT, AVG, MIN and MAX describe each group. HAVING then filters the groups themselves, which is why it can reference an aggregate while WHERE cannot. This is the largest topic in the question bank because almost every analyst task, from revenue by month to active users per plan, is an aggregation with the right grouping key.

What you will practice

  • •Know when a column must appear in GROUP BY and why the database rejects it otherwise
  • •Use WHERE to filter rows before grouping and HAVING to filter groups afterwards
  • •Understand how COUNT(*), COUNT(column) and COUNT(DISTINCT column) differ on NULLs and duplicates
  • •Write conditional aggregation with SUM(CASE WHEN ... THEN 1 ELSE 0 END) to pivot a column into metrics
  • •Combine aggregates with joins without double-counting the fact table

15 of 76 questions in this topic

  • Total Track Countbeginner
  • Track Count by Genreintermediate
  • Average Song Duration by Genreintermediate
  • Top 5 Countries by Salesbeginner
  • Tracks Above Average Pricebeginner
  • Most Prolific Artistsintermediate
  • Rank Artists by Album Countintermediate
  • Running Total of Invoice Amountsintermediate
  • Segment Customers into Quartilesintermediate
  • Basic CTE: Artist Album Countsintermediate
  • CTE: Top Tracks Per Genreadvanced
  • Correlated Subquery: Above Genre Averageintermediate
  • CASE in Aggregation: Count by Categoryintermediate
  • Multiple Aggregations in One Querybeginner
  • GROUP BY Multiple Columnsbeginner