FAQ: Aggregate Functions - Group By I

This community-built FAQ covers the “Group By I” exercise from the lesson “Aggregate Functions”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development
Data Science

Learn SQL

FAQs on the exercise Group By I

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Please Help.

If we were to not use the GROUP BY clause such as

SELECT category, SUM (downloads)
FROM fake_apps;

The program returns 1 row with with the News in the category and the sum of the downloads in the other column.

But why does it select News as the category? It is not the min, max, mode, or avg.


Just wanto to bump this question as I had the exact some one in mind coming here. I think understanding this is fundamental to understanding how SQL works/its logic for organizing queries.

Any reply is very well received! <3

Well since SUM(downloads) only returns one value which is the sum of all category’s downloads, it only has a corresponding value for the SUM(downloads) which is the first value in category (here: news!)

In the context of this exercise, why should we type an * inside the COUNT( ) function? Does it make any difference?

SELECT price, COUNT(*)
FROM fake_apps
GROUP BY price;

1 Like

@ justin976629
I believe it selects News because it is the category with the fewest letters.