Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Function AVG
23. AVG and DISTINCT
Functions SUM, MAX, MIN
Review

Instruction

Yes, that's right. There is also another thing which many people don't know about: you can actually use AVG with DISTINCT to only calculate the average from distinct values:

SELECT AVG(DISTINCT price)
FROM project;

Does that really have any practical application? Well, it might. Take a look at the exercise.

Exercise

For client with ID 10, find the average price (as avg_price) and average distinct price (as avg_distinct_price).

Stuck? Here's a hint!

Use AVG(price) and AVG(DISTINCT price).