Hello coders, today we are going to solve Average Population HackerRank Solution in SQL.
Problem
Query the average population for all cities in CITY, rounded down to the nearest integer.
Input Format
The CITY is described as follows:
Field | Type |
---|---|
ID | NUMBER |
NAME | VARCHAR2(17) |
COUNTRYCODE | VARCHAR2(3) |
DISTRICT | VARCHAR2(20) |
POPULATION | NUMBER |
Solution – Average Population in SQL
MySQL
select floor(avg(population)) from city;
Disclaimer: The above Problem (Average Population) is generated by Hacker Rank but the Solution is Provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.