Databases

1. Databases

Hello and welcome! My name is Jasmin, and I will be your SQL coach.

2. Course goals

We have two main goals in this course. In Chapter One, we will get to know databases, which store and organize data. We'll discuss what databases are and how they are structured to store data. This context will prepare us for our second goal: to interact with data from databases using SQL code in Chapter Two. Let's get started with

3. Structured Query Language (SQL)

SQL. SQL, or Structured Query Language, is the most widely used programming language for communicating with data in databases. It lets us quickly access, organize, and analyze large amounts of data with direct commands, known as queries.

4. Introducing databases

These large amounts of data are stored in a database. Let's imagine that we are in charge of storing and organizing data for a library. We need to keep track of the library's books, its patrons, that is people who have joined the library, and what books are checked out and by whom. Because of that, we need to create a database that contains a checkouts table, a books table, and a patrons table. These tables might look similar to the way data is organized in spreadsheets, but databases are far more powerful. They can handle much more data and are more secure due to encryption.

5. A closer look at tables

A table is a component of a database. Our patrons table stores various data about our library's patrons, such as their library card number, name, the year they joined and the total fines they owe our library.

6. Rows and columns

Tables organize data into rows and columns. Rows contain individual data, and each column describes a specific part of that data. For example, our patrons table has a row for each patron and a column for each part of their data, such as the year they joined.

7. Relational databases

Several tables usually make up a database, and they work together through relationships. Relational databases include tables that share information. This creates connections between them. For example, the checkouts table relates to the patrons and books tables through shared data. The card number column relates checkouts to patrons. The book ID column relates checkouts to books. By arranging information this way, we can answer questions like how many books Izzy checked out.

8. Database advantages

These questions are asked in the form of SQL queries. Many users can write queries to gather insights from the data within a database simultaneously. When a database is queried, the data stored inside the database does not change; rather, the database information is accessed and presented according to instructions in the query.

9. Let's practice!

Alright, let's use this newfound database knowledge in some exercises!