Introduction to Databases, SQL and Writing First Query

Welcome to Databases and SQL

Hello, and welcome to the magical world of databases and SQL!

First off, what is a database? A database is like a huge, digital filing cabinet where you can store, manage, and retrieve data. In this course, we'll focus on a specific type of database known as a relational database. A relational database stores data in tables, much like how an Excel file has different sheets for different sets of data.

Now, SQL, which stands for Structured Query Language, is the standard language used to interact with these databases. Think of it as a toolbox for managing and manipulating data. Whether you want to find a specific piece of data, update it, delete it, or create a new one, SQL is your go-to resource.

SQL and Its Tools - Introduction to MySQL

The tool we're going to use in these lessons is MySQL. While there are multiple database management systems that use SQL, such as PostgreSQL and SQLite, MySQL is a well-established, flexible tool. That's why we've chosen it to kickstart our SQL journey.

Additionally, MySQL's widespread use and supportive community make it an excellent starting point for beginners, ensuring you can find help and resources easily as you learn.

Your Dataset - Lionel Messi's Career Stats

To make our data journey engaging, we're using a unique dataset – tables that capture various aspects of Lionel Messi's illustrious career. This dataset includes detailed statistics from different seasons, matches, goals, assists, and more. For now, let's focus on one table: Seasons. Here's a sneak peek at a sample of the Seasons table.

season_idseasontrophies_won
104/051
205/062

This table records each season with a unique identifier, the name of the season and the number of trophies won. With this in mind, let's move on to writing our first simple SQL command.

The SHOW TABLES Command

Sometimes you might want to know what tables are present in the database you're working with. Here is where the SHOW TABLES command comes in handy:

SQL
SHOW TABLES;

Executing this command returns a list of all the tables in your current database:

Tables_in_practice_db
clubs
competitions
matches
matchevents
players
seasons
Sign up

Join the 1M+ learners on CodeSignal

Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal