Sunday, April 18, 2010

The AVG() Function

0 comments

The AVG() function returns the average value of a numeric column.
SQL AVG() Syntax
SELECT AVG(column_name) FROM table_name
Example:
In order to find the customers that have an OrderPrice value higher than the average OrderPrice value.
SELECT Customer FROM Orders
WHERE OrderPrice>(SELECT AVG(OrderPrice)
FROM Orders)

0 comments: