No history yet

Introduction to Relational Databases

What Is a Database?

At its core, a database is just an organized collection of information. Think of a massive digital filing cabinet. Instead of paper files, you have data. And instead of a human sorting through it, you have a system designed for storing, managing, and retrieving that data quickly and efficiently.

The main purpose of a database is to keep information structured and accessible. Imagine a company with millions of customers. A database allows them to instantly find a specific customer's order history, update their shipping address, or see who bought a certain product. Without a database, this would be a chaotic and impossible task.

A database brings order to data, making it useful and manageable.

The Relational Approach

There are many types of databases, but the most common is the relational database. The key idea is simple: data is stored in a way that connects related pieces of information. It doesn't just store data; it stores the relationships between data.

This structure prevents you from having to repeat information unnecessarily and keeps everything consistent. For example, instead of writing a customer's full address on every single order they place, you can store the address once and link it to all their orders. If they move, you only have to update it in one place. This organized approach is what makes relational databases so powerful and reliable.

Lesson image

The building blocks of this system are simple and will feel familiar if you've ever used a spreadsheet.

Tables, Columns, and Rows

Data in a relational database is organized into tables. Each table holds information about a specific type of thing, like customers, products, or orders.

Each table is made up of columns and rows.

  • Columns define the categories of information for a table. For a Products table, you might have columns for ProductID, ProductName, and Price. Each column holds a specific type of data.
  • Rows represent a single record or item. Each row in the Products table would be one specific product, with entries for each column.
ProductIDProductNamePrice
101Hiking Boots$120.00
102Camping Tent$250.00
103Water Bottle$15.50

In this example, the table is Products. The columns are ProductID, ProductName, and Price. Each row is a unique product, like the 'Hiking Boots' which have an ID of 101 and a price of $120.00.

By organizing data this way, we can easily create another table for Orders that references the ProductID, linking the two tables together. This simple, structured approach is the foundation of how relational databases work.

Ready to check your understanding?

Quiz Questions 1/4

What is the primary function of a database?

Quiz Questions 2/4

In a relational database, what is the main benefit of linking related data across tables?

Understanding these basic building blocks is the first step. Next, we'll see how to interact with this data.