Calculate totals and averages.
Section: aggregation and grouping
Use SUM and AVG
sql
sql
SELECT SUM(total_amount) AS gross_revenue, AVG(total_amount) AS avg_order_value
FROM orders
WHERE status = 'paid';Explanation
Numeric aggregates are core to finance and analytics queries.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing aggregation and grouping