Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Mean values | Aggregating
SQL Basics

book
Mean values

The next function we will talk about - is mean. Mean (average) is probably one of the most simple and usable statistics in real life.

For example, for our audi_cars table, we can calculate the average mileage for cars manufactured in 2020. To calculate the average use AVG function followed by column name.

SELECT AVG(mileage)
FROM audi_cars
WHERE year = 2020
123
SELECT AVG(mileage) FROM audi_cars WHERE year = 2020
copy
Tâche

Swipe to start coding

Using table audi_cars calculate the average price of the A4 model manufactured in 2018.

Solution

SELECT AVG(price)
FROM audi_cars
WHERE model = 'A4' AND year = 2018

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 3

toggle bottom row
Query ResultQuery Result
No query executed yet...
some-alt