title: Need to understand the solution to this query
body: <p>We define an employee's total earnings to be their monthly  worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings for all employees as well as the total number of employees who have maximum total earnings. Then print these values as  space-separated integers.
  This is link to the question for better understanding <a href="https://www.hackerrank.com/challenges/earnings-of-employees/problem" rel="nofollow noreferrer">https://www.hackerrank.com/challenges/earnings-of-employees/problem</a></p>
  
  <p>I am a beginner in SQL and couldn't understand the solution which was given</p>
  
  <pre><code>1.SELECT (months*salary) as earnings,
   2.COUNT(*) FROM Employee
  3. GROUP BY earnings
  4. ORDER BY earnings DESC
   5.LIMIT 1;
  </code></pre>
  
  <p>I understood the first step where we are giving months*salary an Alias which is earnings
  in the 2nd step we are counting the no. of employees from employee table. I didn't understand why we are using group by here, 4th and 5th step is also clear, we used order by clause in order to rank earnings from highest to lowest, and limit 1 will fetch me the highest value. But why GROUP BY?
   Ignore 1,2,3,4,5. These are just numbers I used for better clarity</p>