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.
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.