The AVG() returns the average value of a numeric column.
Syntax:-
SELECT AVG(column_name) FROM table_name;
Example:-
The subsequent SQL gets the average value of the “Price” column from the “Hosting” table:-

SELECT AVG(Price) AS PriceAverage FROM Hosting;

OR

SELECT HostingName, Price FROM Hostings WHERE Price>(SELECT AVG(Price) FROM Hostings);

Categories: SQL Function

0 thoughts on “SQL Avg()”

Leave a Reply