Question: Using python and SQLite, connect to the database called world_updated.db. Using SQL queries in python, answer the following questions ( make appropriate comments for each
- Using python and SQLite, connect to the database called "world_updated.db". Using SQL queries in python, answer the following questions (make appropriate comments for each step):
- Input the data into table 'city':
| ID for city | City Name | Code for country | City population |
|---|---|---|---|
| 5000 | King's Landing | WTO | 5,000,000,000 |
After you input the data, print out just this record from the table 'city' to verify it. Take a screenshot and put in the word file
- Using python, print out the country Name, Continent, Region and country Population of all the countries, whose country population is larger than 1,000,000,000. Take a screenshot and put in the word file
Question:
Since we already updated the data in step 'a' for the city 'King's Landing' in a country 'Westero' (country code WTO), whose population is 5 billion (larger than 1 billion), did you find country 'Westero' in the result from step b? Why or why not?
- Print out all the fields for the cities in the U.S. whose city population is larger than 1,000,000. Use queries to calculate how many cities in the result? What is the average population for them? Take a screenshot and put in the word file
- When you are submitting your Project 12 Assignment to the assignment drop box, please remember to include the world_updated.db file in your submission.
Hint: you may need the following SQL statements to understand the structure of database/tables before you answer the above questions:
select name from sqlite_master where type = 'table';
select sql from sqlite_master where name = 'your table name';
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
