Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the World-X database found here: dev.mysql.com/doc/index-other.html Write a Python script to increase the population of each city in the world_x database by 10% (rounded).

Using the World-X database found here: dev.mysql.com/doc/index-other.html

Write a Python script to increase the population of each city in the world_x database by 10% (rounded).

First, add a new column to the world_x city table using the following MySQL command:

  • ALTER TABLE `world_x`.`city` ADD COLUMN `Population` DOUBLE NULL DEFAULT NULL AFTER `Info`;

The existing population data are stored as JSON datatype in the city table in a field named Info. You learned about JSON data types in Module 2. To obtain the population data from the Info column in the city table, run the following MySQL command:

  • select info->$.Population from city

Your Python script should do the following:

  • Copy the population data from the Info column into the Population column,
  • Increase the population by 10% in the Population column, and
  • List the population before the increase and the population after it was increased.

Please type the answer out.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Using the risk balancing formulation, when is debt profitable?

Answered: 1 week ago