GitGotGo1 / sem

Repository of GitGotGot Java application using SQL to output reports
Apache License 2.0
0 stars 5 forks source link

The population living differences of each country #37

Closed rosshardie closed 5 years ago

rosshardie commented 5 years ago

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

Amckenzie93 commented 5 years ago

Population Report For the population reports, the following information is requested:

Causeless commented 5 years ago
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