Sort, limit, count, sumConcept

Concept

Order and aggregate

ORDER BY amount DESC sorts biggest first (ASC is the default). LIMIT 5 keeps five rows. Aggregates collapse many rows into one value: COUNT(*), SUM(amount), AVG(amount), MIN, MAX. Give results a name with AS: SUM(amount) AS total.

0/5 answered · Enter to check