Density >>>
Scenario world
f35f7fece0cf0019765619c477c900ddd8131dbc27b32e9261f4ab7cdc49773c
See details on the model
In this scenario, we have a single table world in which each row describes a country. The table contains the following attributes:
- name of type VARCHAR(50) NOT NULL, the name of the country (e.g. France)
- continent of type VARCHAR(60), in which continent is the country in (e.g. Europe)
- area of time DECIMAL(10) the area of the country in square kilometer
- population of type DECIMAL(11) the number of inhabitants
- gdp of type DECIMAL(14) the Gross Domestic Product
- capital of type VARCHAR(60) the name of the capital city
- tld of type VARCHAR(5) the Top Level Domain of the country (the last part of the domain names of the country, e.g. .fr for France)
- flag of type VARCHAR(255) an url of the flag of the country
Question
Compute, for every continent name, three columns containing the following three values, rounded to the nearest integer with the ROUND function:
- its population density (i.e., the continent's population divided by the continent's area, taking all countries into account),
- the average of the population densities of its countries (for the countries with a non-NULL and non-zero area),
- the sum of the population densities of its countries (for the countries with a non-NULL and non-zero area), divided by the number of countries
Do you understand why the three values are different?
{"rows":[["Africa","38","88","83"],["Asia","144","382","382"],["Caribbean","176","272","248"],["Eurasia","9","55","55"],["Europe","70","578","565"],["North America","23","94","94"],["Oceania","4","133","123"],["South America","23","42","42"]],"fields":[{"name":"continent","dataTypeID":1043},{"name":"total","dataTypeID":1700},{"name":"average","dataTypeID":1700},{"name":"fake_average","dataTypeID":1700}],"affectedRows":0}
False
False