Finding the number of majors per unique major categories

Screen Link:

how do I find the number of rows that fall under a unique category?
for instance, i can use SELECT DISTINCT to print a list of distinct major categories.
however, the result i want is this:
engineering: 40
business: 25

how do i go about that?

That’s something that will be covered in the next mission, Group Summary Statistics.

You will learn about the GROUP BY clause and how to use/apply it. It essentially “groups” the data based on the categories in a specific column.

If you would still like to see the code on how to do this, let me know, and I can post that here. It’s great that you are thinking ahead and trying different things out, but you can also consider waiting if you’d like!

1 Like