Exploring Databases and Relational Data Structures
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 - SQL for Online Shopping
To make our data journey engaging, we're using a dataset that captures various aspects of an online shopping platform. This dataset includes detailed records of categories, customers, products, orders, and order items. For now, let's focus on one table: Categories. Here's the Categories table:
| category_id | category_name |
|---|---|
| 1 | Flashcards |
| 2 | Worksheets |
| 3 | Guides |
| 4 | Podcasts |
| 5 | Courses |
This table records each category with a unique identifier and the name of the category. 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:
Executing this command returns a list of all the tables in your current database:
| Tables_in_practice_db |
|---|
| categories |
| customers |
| orderitems |
| orders |
| products |
