Discovering SQL and Taylor Swift's Discography - Your First Database 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.

Your Dataset - Taylor Swift's Music

To make our data journey engaging, we're using a unique dataset - tables that feature Taylor Swift's discography. For now, let's focus on one table: Albums. Here's a sneak peek at a sample of the Albums table.

AlbumIDAlbumNameReleaseDate
11989 (Taylor's Version) [Deluxe]2023-10-27
21989 (Taylor's Version)2023-10-26
3Speak Now (Taylor's Version)2023-07-07
4Midnights (The Til Dawn Edition)2023-05-26
5Midnights (3am Edition)2022-10-22

This table provides a clear understanding of Taylor Swift's album history, all brought to life by SQL.

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.

Writing Your First Query in SQL

It's time to roll up our sleeves and delve into our first SQL command: SHOW TABLES;. What does this command do? Simply put, it presents a list of all the tables in our dataset, much like asking our digital filing cabinet for a list of all its drawers.

SHOW TABLES;

When we run this command in a MySQL environment, we will see a result like this:

albums
songfeatures
songs

What we've done here is ask the database to list all of its tables - a request to which it graciously complied!

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