What if you could find the average of hundreds of numbers instantly without lifting a finger?
Why AVG function in SQL? - Purpose & Use Cases
Imagine you have a long list of test scores written on paper. To find the average score, you must add all the numbers by hand and then divide by how many scores there are.
Doing this by hand is slow and easy to make mistakes. If the list is very long or changes often, recalculating the average every time wastes a lot of time and can cause errors.
The AVG function in SQL quickly calculates the average of a column of numbers for you. It does all the adding and dividing automatically, even if the data changes or grows larger.
Add all scores manually and divide by countSELECT AVG(score) FROM tests;
It lets you instantly find the average value from large or changing data sets without any manual math.
A teacher can use AVG to find the average grade of a whole class from a database instead of adding each student's score by hand.
Manual averaging is slow and error-prone.
AVG function automates calculating averages in databases.
It saves time and reduces mistakes for large or changing data.