City Names and Respective Countries

Beginner

In this project, you will learn how to retrieve city names and their corresponding country names from a MySQL database using an equi-join query. This project will help you understand the basics of SQL queries and how to work with relational databases.

SQLMySQL

Introduction

In this project, you will learn how to retrieve city names and their corresponding country names from a MySQL database using an equi-join query. This project will help you understand the basics of SQL queries and how to work with relational databases.

👀 Preview

MariaDB [world]> SOURCE /home/labex/project/getCountryName.sql;
+----------------+-------------+
| CityName       | CountryName |
+----------------+-------------+
| Oranjestad     | Aruba       |
| Kabul          | Afghanistan |
| Qandahar       | Afghanistan |
| Herat          | Afghanistan |
| Mazar-e-Sharif | Afghanistan |
| Luanda         | Angola      |
| Huambo         | Angola      |
| Lobito         | Angola      |
| Benguela       | Angola      |
| Namibe         | Angola      |
+----------------+-------------+
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 a SQL file into a MySQL database
  • How to write an equi-join query to retrieve data from multiple tables
  • How to simplify table names and use aliases in SQL queries
  • How to run a SQL script in MySQL

🏆 Achievements

After completing this project, you will be able to:

  • Understand the basic structure and syntax of SQL queries
  • Perform equi-join operations to retrieve data from multiple tables
  • Simplify table names and use aliases to make your SQL queries more readable
  • Import and manage data in a MySQL database
  • Run SQL scripts to execute complex queries

Teacher

labby

Labby

Labby is the LabEx teacher.