carolinemcsherry / SCAD

Software Engineering Methods Coursework Assessment
Apache License 2.0
1 stars 0 forks source link

User Story 1 - As a Data Analyst, I need to generate a population report containing the following information for continents, regions, and countries: Name of the continent/region/country, total population, total population living in cities (including a percentage), and total population not living in cities (including a percentage), to analyse urbanization trends, assess rural-urban migration patterns, and understand population distribution dynamics for strategic planning and decision-making purposes within the organization #85

Closed djackson001 closed 9 months ago

djackson001 commented 9 months ago

tasks to complete Connect to the existing database. Add function to retrieve data on population Add function to retrieve data on countries Add function to retrieve data on continents Add function to retrieve data on regions Generate report

carolinemcsherry commented 9 months ago

select country.name, sum(country.Population) as Total_Country_Population, SUM(city.Population) as Total_City_Population, CONCAT(round(SUM(city.Population) / SUM(country.Population) 100, 2),'%') as City_Population_Percentage, SUM(country.Population)-SUM(city.Population) as Total_Not_City_Population, CONCAT(100 - round(SUM(city.Population) / SUM(country.Population) 100, 2) ,'%') as None_City_Population_Percentage from country JOIN city ON country.Code = city.CountryCode group by country.name;

carolinemcsherry commented 9 months ago

SELECT country.Continent, sum(country.Population) as Total_Continent_Population, SUM(city.Population) as Total_City_Population, CONCAT(round(SUM(city.Population) / SUM(country.Population) 100, 2),'%') as City_Population_Percentage, SUM(country.Population)-SUM(city.Population) as Total_Not_City_Population, CONCAT(100 - round(SUM(city.Population) / SUM(country.Population) 100, 2) ,'%') as None_City_Population_Percentage from country JOIN city ON country.Code = city.CountryCode GROUP BY country.Continent;

carolinemcsherry commented 9 months ago

SELECT country.Region, sum(country.Population) as Total_Region_Population, SUM(city.Population) as Total_City_Population, CONCAT(round(SUM(city.Population) / SUM(country.Population) 100, 2),'%') as City_Population_Percentage, SUM(country.Population)-SUM(city.Population) as Total_Not_City_Population, CONCAT(100 - round(SUM(city.Population) / SUM(country.Population) 100, 2) ,'%') as None_City_Population_Percentage from country JOIN city ON country.Code = city.CountryCode GROUP BY country.Region;