To exclude entries with “0”, you need to use NULLIF() with function AVG().

SELECT AVG(NULLIF(yourColumnName, 0)) AS anyAliasName FROM yourTableName;
mysql> select AVG(nullif(StudentMarks, 0)) AS Exclude0Avg from AverageDemo;