SQL JOINS study

Hi Everybody! I did not understand why we used “2” after GROUP BY 1. Can somebody help me to understand the usage of this command. I also indicated on the picture.

Hi @uzan.selcuk!

Welcome to the community - we’re excited to have you here!

In order to get an answer in a timely manner, copy/pasting your code and including a link to the mission instrumental in helping others reproduce or take a closer look at your question. You can read more about that here!

Happy learning!

1 Like

When you do aggregates (e.g. count), you have to group by every field that is not being aggregated.
Hope that helps.

1 Like

when you use groupby, it means you are computing your outcome based on some features. Needless to say that either 1 or 2 is a shortcut of grouping your outcome based on album. 1 is album and 2 is artist.
If you use 1 it shows you are counting all tracks purchased based on album, but with 1 and 2, then it means your count result will depend on album and artist.

I hope this helps.