Overview - AVG function
What is it?
The AVG function in SQL calculates the average value of a numeric column in a table. It adds up all the numbers in that column and then divides by the count of those numbers. This helps find the typical or central value in a set of data. It works only with numbers and ignores empty or missing values.
Why it matters
Without the AVG function, finding the average of many numbers stored in a database would require manual calculation or complex code. This function saves time and reduces errors, making it easy to summarize data like average sales, temperatures, or test scores. It helps businesses and people make decisions based on typical values rather than individual data points.
Where it fits
Before learning AVG, you should understand basic SQL SELECT queries and how to work with tables and columns. After mastering AVG, you can learn other aggregate functions like SUM, COUNT, MIN, and MAX, and how to group data using GROUP BY for more detailed summaries.