dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Understanding the AVG Function in MySQL

Learn how to use the AVG function to calculate the average in MySQL.


advertisement

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


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 |
+ -- -- -- -- -- -+

 

Visit the DevX Tip Bank

 





   
Sridhar M S. is a Java developer from Bangalore, India. He holds a master's degree in Computer Science.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Thanks for your registration, follow us on our social networks to keep up-to-date