Understanding the AVG Function in MySQL

Assume there is a column named MARKS in the table STUDENT_DETAILS, and we need to calculate the average. The following query will be necessary:

SELECT AVG(MARKS) AVERAGE FROM STUDENT_DETAILS; 

This will calculate and display the average of the available values in the MARKS column as below.

Assuming the values as 5,6 and 7 in three rows, it works as below.

+ -- -- -- -- -- -+| AVERAGE |+ -- -- -- -- -- -+| 6.0000 |+ -- -- -- -- -- -+
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: