SQL Practice Logo

SQLPractice Online

COUNT, SUM, AVG, MIN, MAX: Real-World

Module: Aggregate Functions & Grouping

These five functions are the core building blocks of every report and dashboard. They answer critical business questions: "How many orders?" (COUNT), "What is total revenue?" (SUM), "What is average salary?" (AVG), "What is lowest inventory?" (MIN), "What was highest sale?" (MAX).

E-commerce Dashboard KPIs

Platform needs real-time dashboard showing key metrics

SELECT

COUNT(*) AS orders_today,

SUM(total_amount) AS total_revenue,

AVG(total_amount) AS avg_order_value

FROM orders

WHERE order_date >= CURRENT_DATE;

Query runs every 5 minutes to update executive dashboard

All