Revising Aggregations – Averages in SQL | HackerRank Solution

Hello coders, today we are going to solve Revising Aggregations – Averages HackerRank Solution in SQL.

Revising Aggregations - Averages in SQL

Problem

Query the average population of all cities in CITY where District is California.

Input Format

The CITY is described as follows:

FieldType
IDNUMBER
NAMEVARCHAR2(17)
COUNTRYCODEVARCHAR2(3)
DISTRICTVARCHAR2(20)
POPULATIONNUMBER
CITY

Solution – Revising Aggregations – Averages in SQL

MySQL

select avg(population) from city where district='California';

Disclaimer: The above Problem (Revising Aggregations – Averages) is generated by Hacker Rank but the Solution is Provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.

Leave a Comment

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