Algorithm/SQL

[SQL][HackerRank] Revising Aggregations - Averages

융무 2020. 6. 11. 14:34

https://www.hackerrank.com/challenges/revising-aggregations-the-average-function/problem?h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen

 

Revising Aggregations - Averages | HackerRank

Query the average population of all cities in the District of California.

www.hackerrank.com

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

Input Format

The CITY table is described as follows:

  • query average population ==> SELECT AVG(POPULATION)
  • in CITY table ==> FROM CITY
  • District is California ==> WHERE DISTRICT = ‘California’
SELECT AVG(POPULATION)
FROM CITY
WHERE DISTRICT = 'California';