Introduction
In this project, you will learn how to query the population data in the city table and retrieve the top 5 countries or regions with the greatest population.
๐ Preview
MariaDB [world]> SOURCE /home/labex/project/getBigPopulation.sql;
+-------------+---------------+
| CountryCode | SumPopulation |
+-------------+---------------+
| CHN | 175953614 |
| IND | 123298526 |
| BRA | 85876862 |
| USA | 78625774 |
| JPN | 77965107 |
+-------------+---------------+
5 rows in set (0.007 sec)
๐ฏ Tasks
In this project, you will learn:
- How to access MySQL using the
sudo
command without any password
- How to import data from a SQL file into MySQL
- How to write an SQL query to fetch the top 5 countries or regions with the greatest population
- How to run the SQL query and display the results
๐ Achievements
After completing this project, you will be able to:
- Understand how to work with MySQL databases
- Write SQL queries to retrieve data from a database
- Analyze and interpret population data from the city table
Skills Graph
%%%%{init: {'theme':'neutral'}}%%%%
flowchart RL
mysql(("`MySQL`")) -.-> mysql/BasicKeywordsandStatementsGroup(["`Basic Keywords and Statements`"])
sql(("`SQL`")) -.-> sql/BasicSQLCommandsGroup(["`Basic SQL Commands`"])
sql(("`SQL`")) -.-> sql/DataManipulationandQueryingGroup(["`Data Manipulation and Querying`"])
mysql/BasicKeywordsandStatementsGroup -.-> mysql/source("`External Code Execution`")
sql/BasicSQLCommandsGroup -.-> sql/select("`SELECT statements`")
sql/DataManipulationandQueryingGroup -.-> sql/order_by("`ORDER BY clause`")
mysql/BasicKeywordsandStatementsGroup -.-> mysql/select("`Data Retrieval`")
mysql/BasicKeywordsandStatementsGroup -.-> mysql/use_database("`Database Selection`")
sql/BasicSQLCommandsGroup -.-> sql/insert("`INSERT INTO statements`")
sql/BasicSQLCommandsGroup -.-> sql/create_table("`CREATE TABLE statements`")
sql/DataManipulationandQueryingGroup -.-> sql/group_by("`GROUP BY clause`")
subgraph Lab Skills
mysql/source -.-> lab-301352{{"`Largest Population in Five Countries`"}}
sql/select -.-> lab-301352{{"`Largest Population in Five Countries`"}}
sql/order_by -.-> lab-301352{{"`Largest Population in Five Countries`"}}
mysql/select -.-> lab-301352{{"`Largest Population in Five Countries`"}}
mysql/use_database -.-> lab-301352{{"`Largest Population in Five Countries`"}}
sql/insert -.-> lab-301352{{"`Largest Population in Five Countries`"}}
sql/create_table -.-> lab-301352{{"`Largest Population in Five Countries`"}}
sql/group_by -.-> lab-301352{{"`Largest Population in Five Countries`"}}
end