Revising Aggregations – Averages Solution
Hello Friends in this article i am gone to share Hacker Rank SQL Solutions with you | Revising Aggregations – Averages Solution
Query the average population of all cities in CITY where District is California.
The CITY is described as follows:
Solution – Revising Aggregations – Averages
select avg(population) from city where district='California';
What do you mean by aggregation in SQL?
SQL aggregation is the task of collecting a set of values to return a single value. It is done with the help of aggregate functions, such as SUM, COUNT, and AVG. For example, in a database of products, you might want to calculate the average price of the whole inventory.
A single-value metrics aggregation that computes the average of numeric values that are extracted from the aggregated documents. These values can be extracted either from specific numeric or histogram fields in the documents.
Note: AVG is an aggregation function used to calculate the average of the values of all the records in the specified column name passed to the function
Disclaimer: The above Problems are generated by Hacker Rank but the Solutions are Provided by NYANDER.COM. All Hacker Rank SQL Solutions Shared only for Educational and Learning Purpose.