Mysql AVG() Functions Query

The AVG() function returns the average value of a numeric column.

To understand AVG function, consider an products table, which is having following query

Code

$sql = "SELECT AVG(price) FROM Products"; 
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_assoc($result))
{

}

Leave a Reply

Your email address will not be published. Required fields are marked *