Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Ordering
Limiting the output
Eliminating duplicate results
Aggregation
16. Find the average value
Grouping
HAVING: filtering and ordering groups
Let's practice

Instruction

OK, now that you know what the highest salary is, let's discuss another function:

SELECT AVG(total_sum)
FROM orders
WHERE customer_id = 100;

The function AVG() finds the average value of the specified column.

In our example, we'll get the average order value for the customer with ID of 100.

Exercise

Find the average salary in the employees table for the year 2013.

Stuck? Here's a hint!

Type:

SELECT AVG(salary)
FROM employees
WHERE year = 2013;