avg() function in MYSQL by R4R Team

MYSQL AVG() function:
-Basically, AVG() function is return the average value of all records of the columns.

Syntax:
SELECT AVG(expression)
FROM table_name
WHERE conditions;

Display all record of table:

SELECT * FROM marksheet;

S.NO Subject Marks
1 Mathematics 95
2 Science 70
3 Social Science 50
4 English 60
5 Python 85
6 Chemistry 60

Now we find Average of all marks:

SELECT AVG(Marks) as Percentage from marksheet;

Percentage
70




Leave a Comment: