Introduction
In this project, you will learn how to execute an equal join query on the city
, country
, and countrylanguage
tables in MySQL. The goal is to retrieve the city name, corresponding country name, and language from these tables.
ð Preview
MariaDB [world]> SOURCE /home/labex/project/getCountryNameAndLanguage.sql;
+----------------+-------------+------------+
| CityName | CountryName | Language |
+----------------+-------------+------------+
| Oranjestad | Aruba | Dutch |
| Oranjestad | Aruba | English |
| Oranjestad | Aruba | Papiamento |
| Oranjestad | Aruba | Spanish |
| Kabul | Afghanistan | Balochi |
| Qandahar | Afghanistan | Balochi |
| Herat | Afghanistan | Balochi |
| Mazar-e-Sharif | Afghanistan | Balochi |
| Kabul | Afghanistan | Dari |
| Qandahar | Afghanistan | Dari |
+----------------+-------------+------------+
10 rows in set (0.001 sec)
ðŊ Tasks
In this project, you will learn:
- How to access MySQL using the
sudo
command without a password - How to import data from the
world.sql
script into MySQL - How to write an equal join query to retrieve the desired information from the tables
- How to limit the query results to the first 10 rows
ð Achievements
After completing this project, you will be able to:
- Understand the concept of SQL joins and how to use them effectively
- Retrieve data from multiple tables in a relational database
- Apply SQL queries to filter and limit the results as needed
- Gain practical experience in working with MySQL databases