Skip to the workspace
Pebellslearn by building
Learn the Basics  ›  Lesson

What Is a Relational Database?

What are Relational Databases? 12 minA relational database stores each kind of thing in its own table of rows and columns and links tables together through shared key values.

Set up SQL with SQLite and run your first file

SQL needs a database engine to execute queries. Start with SQLite, which works on a local file without a server account, then learn how other databases differ later.

Already set up? Continue to the lesson

New to coding? Meet the tools and find the terminal
SQL
The language used to describe queries and changes.
SQLite engine and CLI
Execute SQL and provide an interactive sqlite> prompt.
Database file
Stores tables and data on disk when you create them; an SQL source file stores instructions.

A terminal is a window for commands. Its shell interprets those commands. PATH is the list of folders the shell searches for programs. An editor extension adds editing help; it usually does not install the language itself.

In VS Code, open your project folder, then choose View → Terminal. Type at the cursor in the Terminal panel, not in Output, the source file, or the browser address bar. Our command blocks omit prompt symbols such as $ and >; do not add them.

Official VS Code screenshot: the Terminal tab is selected below the editor, with the PowerShell shell name at the right and a command prompt at the left.
Find the Terminal tab and shell name. Open full-size screenshot (new tab).

The dropdown next to the plus button selects a shell. Choose the shell named in your operating-system instructions below. Available choices depend on what you installed.

Official VS Code screenshot: the arrow beside the terminal plus button opens a list containing PowerShell, Command Prompt, Git Bash and Ubuntu WSL.
Official documentation screenshots by Microsoft, VS Code terminal guide, CC BY 3.0 US. Unmodified; your version may look different.

Choose a system to see its installation steps. A computer is needed for these local setup instructions.

Official documentation and illustrated guides

Instructions reviewed 2026-10-27. Use the linked installer page for current versions and supported operating systems.

Continue to the lesson

sql / What Is a Relational Database?

Explore each scene at your own pace.

01 · The rule

The rule

What Is a Relational Database?

A relational database stores each kind of thing in its own table of rows and columns and links tables together through shared key values.

Separate entities into tables and follow the keys that relate their rows.

Imagine a small online shop that keeps its records in one giant spreadsheet. Every time Asha places an order, someone types her name, her city and her email again. When she moves from Pune to Delhi, half her rows get updated and half do not, and now the shop has two versions of the truth. A relational database exists to stop exactly this.

The rule

One thing per table, one fact per row, linked by keys.

A relational database stores data in tables (the formal name is relations). Each table holds one kind of thing: customers, products, orders. Each row is one instance of that thing, and each column is one detail every row has. One column, the primary key, gives every row a unique identity, like customer_id.

Tables connect by storing another table's key. An order does not copy Asha's name and city; it stores her customer_id, and the database can look up the rest whenever you ask. That stored key is called a foreign key.

This is the small shop we will use for the whole course:

customers (customer_id, name, city, email, joined_on)
products  (product_id, name, category, price)
orders    (order_id, customer_id, product_id, quantity, order_date, status)

Asha's city lives in exactly one row of customers. Change it once and every order that points to her sees the new city automatically.

You talk to a relational database in SQL (Structured Query Language). You describe what you want — "every order from a customer in Pune" — and the database works out how to fetch it.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.