Page 107 - SQL
P. 107

GROUP BY EmpID


        is saying:


        "Give me the sum of MonthlySalary's for each EmpID"


        So if your table looked like this:


         +-----+-------------+
         |EmpID|MonthlySalary|
         +-----+-------------+
         |1    |200          |
         +-----+-------------+
         |2    |300          |
         +-----+-------------+


        Result:


         +-+---+
         |1|200|
         +-+---+
         |2|300|
         +-+---+


        Sum wouldn't appear to do anything because the sum of one number is that number. On the other
        hand if it looked like this:


         +-----+-------------+
         |EmpID|MonthlySalary|
         +-----+-------------+
         |1    |200          |
         +-----+-------------+
         |1    |300          |
         +-----+-------------+
         |2    |300          |
         +-----+-------------+


        Result:


         +-+---+
         |1|500|
         +-+---+
         |2|300|
         +-+---+


        Then it would because there are two EmpID 1's to sum together.


        ROLAP aggregation (Data Mining)



        Description


        The SQL standard provides two additional aggregate operators. These use the polymorphic value



        https://riptutorial.com/                                                                               89
   102   103   104   105   106   107   108   109   110   111   112