mysql AVG() function


  Translation results:

UK ['eɪvɡ] US ['eɪvɡ]

abbr.average average

mysql AVG() functionsyntax

Function: The AVG function returns the average value of the numerical column. NULL values ​​are not included in the calculation.

Syntax: SELECT AVG(column_name) FROM table_name

mysql AVG() functionexample

//计算 "OrderPrice" 字段的平均值
SELECT AVG(OrderPrice) AS OrderAverage FROM Orders;
//找到 OrderPrice 值高于 OrderPrice 平均值的客户
SELECT Customer FROM Orders WHERE OrderPrice>(SELECT AVG(OrderPrice) FROM Orders);

Home

Videos

Q&A