Top Earners

  • + 3 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.