Group by
GROUP BY groups the data fetched by SELECT The query finds the customer_id values in the payment table, collects the ‘amount’ values of those with the same customer__id value, and groups them according to the customer_id. In other words, it returns the sum of the amount values of the rows with a specific customer_id value. … Group by