You are viewing a single comment's thread. Return to all comments →
Adityaanand,
When referring to the code
select salary*months as earnings, count(*) from employee group by 1
"group by 1" is simply stating that you want to group by the data in Column 1.
Since the columns are created in the order they are declared, column 1 or just "1" in this case, is "earnings" since it is declared first.
Therefore in this situation: "Group by 1" is just shorthand for "Group by Earnings".
Cheers.
Seems like cookies are disabled on this browser, please enable them to open this website
Top Earners
You are viewing a single comment's thread. Return to all comments →
Adityaanand,
When referring to the code
"group by 1" is simply stating that you want to group by the data in Column 1.
Since the columns are created in the order they are declared, column 1 or just "1" in this case, is "earnings" since it is declared first.
Therefore in this situation: "Group by 1" is just shorthand for "Group by Earnings".
Cheers.