Accessing MySQL Database and Querying GNP

Beginner

In this project, you will learn how to access a MySQL database, import data, and query the Gross National Product (GNP) for all countries.

SQLMySQL

Introduction

In this project, you will learn how to access a MySQL database, import data, and query the Gross National Product (GNP) for all countries.

👀 Preview

MariaDB [world]> SOURCE /home/labex/project/getGNP.sql;
+----------------------------------------------+------------+
| Name                                         | GNP        |
+----------------------------------------------+------------+
| Aruba                                        |     828.00 |
| Afghanistan                                  |    5976.00 |
| Angola                                       |    6648.00 |
    ...
| Zambia                                       |    3377.00 |
| Zimbabwe                                     |    5951.00 |
+----------------------------------------------+------------+
239 rows in set (0.000 sec)

🎯 Tasks

In this project, you will learn:

  • How to start the MySQL service and access the database using the sudo command without a password
  • How to import data from a SQL file into the world database
  • How to query the GNP attribute from the country table and display the Name and GNP for all countries

🏆 Achievements

After completing this project, you will be able to:

  • Manage a MySQL database, including starting the service, accessing the database, and importing data
  • Write SQL queries to retrieve specific data from a database table
  • Understand how to work with the world database and the country table

Teacher

labby

Labby

Labby is the LabEx teacher.