Closed rosshardie closed 5 years ago
Population Report For the population reports, the following information is requested:
SELECT
country.Name
AS 'Country',
country.Population
AS 'Total Population',
SUM(city.Population)
AS 'Population Living in Cities',
(SUM(city.Population) / country.Population) * 100
AS 'Population Living in Cities (%)',
country.Population - SUM(city.Population)
AS 'Population Not Living in Cities',
((country.Population - SUM(city.Population)) / country.Population) * 100
AS 'Population Not Living in Cities (%)'
FROM country
JOIN city ON city.CountryCode = country.Code
WHERE country.name LIKE 'Aruba' -- where clause taken from user input
GROUP BY country.Name, country.Population
As a user I want to be able to see the population of people living in cities, and people not living in cities of each country