Exercise 4.03 – using functions
In this exercise, you will use the world
database again. For a news article related to countries' independence, you want to compile a list of countries that have been independent for more than 1,000 years. For this, you need the following:
- The independence year
- The number of years since independence
- The population in millions
- The average population per square km (rounded to integers)
You will connect to the world
database, select the columns you need, and apply a condition to find countries that are more than 1,000 years old. Then, you will add calculated columns and convert values where needed. Follow these steps to complete this exercise:
- Connect to MySQL with Workbench and the appropriate user.
- Make sure that you are using the
world
database:USE world;
This query provides the following results:
- Select the columns we need and...