Introduction
In this project, you will learn how to query the GNP (Gross National Product) and population of countries with a higher GNP than France using a single row subquery operation on the country
table in a MySQL database.
๐ Preview
MariaDB [world]> SOURCE /home/labex/project/getGNP.sql;
+---------------+------------+------------+
| Name | GNP | Population |
+---------------+------------+------------+
| Germany | 2133367.00 | 82164700 |
| Japan | 3787042.00 | 126714000 |
| United States | 8510700.00 | 278357000 |
+---------------+------------+------------+
3 rows in set (0.001 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 a MySQL database
- How to write a SQL query to retrieve the name, GNP, and population of countries with a higher GNP than France
๐ Achievements
After completing this project, you will be able to:
- Understand how to use a single row subquery in SQL to filter data based on a condition
- Demonstrate the ability to import data into a MySQL database and perform complex queries
- Apply your SQL knowledge to solve real-world data analysis problems
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/where("`WHERE 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`")
sql/DataManipulationandQueryingGroup -.-> sql/subqueries("`Subqueries`")
subgraph Lab Skills
mysql/source -.-> lab-301317{{"`Country GNP and Population Query`"}}
sql/select -.-> lab-301317{{"`Country GNP and Population Query`"}}
sql/where -.-> lab-301317{{"`Country GNP and Population Query`"}}
mysql/select -.-> lab-301317{{"`Country GNP and Population Query`"}}
mysql/use_database -.-> lab-301317{{"`Country GNP and Population Query`"}}
sql/insert -.-> lab-301317{{"`Country GNP and Population Query`"}}
sql/create_table -.-> lab-301317{{"`Country GNP and Population Query`"}}
sql/group_by -.-> lab-301317{{"`Country GNP and Population Query`"}}
sql/subqueries -.-> lab-301317{{"`Country GNP and Population Query`"}}
end