Calculate summary metrics.
Section: Aggregation and Grouping
Use common aggregate functions
sql
sql
SELECT
COUNT(*) AS total_rows,
SUM(amount) AS total_amount,
AVG(amount) AS avg_amount,
MIN(amount) AS min_amount,
MAX(amount) AS max_amount
FROM payments;Explanation
Most SQL engines support these core aggregate functions.
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