We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Average

Just like we may want to find the minimum or maximum values within a dataset, sometimes we need to know the average!

SQL offers us the AVG() function. Similar to MAX(), AVG() calculates the average of all non-NULL values.

SELECT AVG(song_length)
FROM songs;

This query returns the average song_length in the songs table.

Assignment

Our marketing team is trying to determine the best marketing channels to advertise through, but they need more information about our current users. They want to know the average age of users in the United States.

Return a single value representing the average age of all users whose country_code is US.