Question
Consider two relation instances below, with the following schemas: Country (country_name, continent); City (city_name, country_name, isCapital, population). For each question (a)-(c) below, write a SQL
Consider two relation instances below, with the following schemas:
Country (country_name, continent); City (city_name, country_name, isCapital, population).
For each question (a)-(c) below, write a SQL query for an Oracle system
Country
Country_name | Continent |
US | North America |
Canada | North America |
England | Europe |
Germany | Europe |
France | Europe |
Mali | Africa |
City
City_Name | Country_Name | isCapital | Population |
New York, NY | US | no | 8,000,000 |
Washington, DC | US | yes | 600,000 |
Philadelphia, PA | US | no | 1,500,000 |
Ottawa | Canada | yes | 800,000 |
Toronto | Canada | no | 2,500,000 |
Berlin | Germany | yes | 3,500,000 |
Hamburg | Germany | no | 2,000,000 |
Bonn | Germany | no | 300,000 |
Paris | France | yes | 2,000,000 |
Lyon | France | no | 700,000 |
Bamako | Mali | yes | 2,000,000 |
Timbuktu | Mali | no | 50,000 |
Mopti | Mali | no | 100,000 |
QUESTIONS (a-c)
(a) List the average population and number of all European cities with population of more than 600,000.
(b) Identify the city with largest population for each country. List its country name, and the population.
(c) For each country, list its name and belonging continent, along with its total population that is over 1 million. Also sort the result by the total population in descending order.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started