Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Reporting with SQL!
You have completed Reporting with SQL!
Preview
Averages are great for calculating averages of scores, reviews and sales.
To get the average value of a numeric column use the AVG() function.
SELECT AVG(<numeric column>) FROM <table>;
SELECT AVG(<numeric column>) FROM <table> GROUP BY <other column>;
Cheat Sheets
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
In this video we'll answer
questions on averages.
0:00
Let's say we wanted to forecast
how much we could expect to
0:02
make when we generate a set and
amount of orders.
0:06
What is the average amount
people spend per order?
0:09
Here's a simple query for
0:13
selecting the cost at the time
of purchase for all orders.
0:15
We can use the aggregate
function of average or AVG.
0:19
Let's also provide an understandable label
of average in our report used in an alias.
0:25
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up