Lecture

AVG, MAX, MIN

SQL provides aggregate functions to calculate average, maximum, and minimum values across rows of numeric data. These functions are commonly used in analytics, reporting, and performance tracking.


AVG(): Average Value

The AVG() function returns the average value from a numeric column.

Calculate average order total
SELECT AVG(order_total) FROM client_orders;

This returns the average order value from all client orders.

Note: AVG() automatically ignores NULL values when calculating the average.


MAX(): Highest Value

The MAX() function returns the highest value found in a numeric column.

Find largest order total
SELECT MAX(order_total) FROM client_orders;

This query returns the largest order total recorded.


MIN(): Lowest Value

The MIN() function returns the lowest value found in a numeric column.

Find smallest order total
SELECT MIN(order_total) FROM client_orders;

This query returns the smallest order amount recorded.

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