AVG, MAX, MIN
SQL provides aggregate functions to calculate average, maximum, and minimum values across rows of numeric data. These are useful for analytics, reporting, and decision-making.
AVG()
: Average Value
The AVG()
function calculates the average value of a numeric column.
Calculate average order total
SELECT AVG(order_total) FROM client_orders;
This returns the average order value from all client orders.
⚠️ Null values are ignored in the average calculation.
MAX()
: Highest Value
The MAX()
function returns the highest value in a numeric column.
Find largest order total
SELECT MAX(order_total) FROM client_orders;
Returns the highest order total recorded.
MIN()
: Lowest Value
The MIN()
function returns the lowest value in a numeric column.
Find smallest order total
SELECT MIN(order_total) FROM client_orders;
Returns the smallest (minimum) order amount.
Quiz
0 / 1
What SQL function would you use to find the smallest value in a set of data?
To find the smallest order total, use the function.
AVG()
MAX()
MIN()
SUM()
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help
Code Editor
Run
Generate
Tables
Execution Result