Backend for Dummies: Relational Databases

Hi! this blog post is for new comers to backend development. I will cover the basics of Relational Databases, Primary and Foreign Keys, Database Relationships and building a useful Database Schema.
What is a Relational Database?
At its core, a database is just a bunch of tables where data lives (I know, groundbreaking).
The relational part is what makes things interesting—it means those tables are linked together through shared keys. These relationships let you combine data across tables in meaningful ways.
Think of it like this: instead of stuffing everything into one giant spreadsheet (please don’t), you break your data into smaller, focused tables and connect them logically.
Here are some of the most common relationships:
- One-to-One
- One-to-Many
- Many-to-Many
Let’s say you’re building a music streaming app. You’ve got Users and their Playlists. One user can have many playlists, but each playlist belongs to only one user: that’s a One-to-Many relationship.

wow. what a drawing
Primary and Foreign Keys
Now that we understand the “relationship” part, how do we actually connect those tables?
That’s where primary and foreign keys come in.
- A Primary Key is like a unique ID badge for each row. No two records can share it.
- A Foreign Key is a reference: it’s how one table points to another.
In our example:
- The Users table might have a user_id as its primary key.
- The Playlists table could have its own playlist_id as a primary key, and a user_id column as a foreign key.
This foreign key says, “Hey, I belong to this user.”
Lets Dive into an Example!
User Table
| user_id | name | |
|---|---|---|
| 1 | Dillon | dillon@example.com |
| 2 | Maya | maya_ross@example.com |
| 3 | Alex | alex123@example.com |
Playlist Table
| playlist_id | title | user_id |
|---|---|---|
| 101 | Rap Vibes | 1 |
| 102 | RnB Nights | 1 |
| 103 | Chill Mix | 2 |
| 104 | Gym Playlist | 3 |
| 105 | Study Flow | 3 |
- The Users table’s user_id column is a primary key—it uniquely identifies each user.
- The Playlists table has its own playlist_id as a primary key, but also includes a user_id column—a foreign key that links each playlist back to the user who owns it.
For example: Dillon (with user_id 1) ‘owns’ three playlists “Rap Vibes”, “RnB Nights”
Building a Database Schema
A schema is your blueprint—a map of how all your tables fit together.
When designing one, focus on:
- Entities: the main objects in your system (Users, Playlists, Songs)
- Relationships: how they connect (One-to-Many, Many-to-Many, etc.)
Designing a good DB Schema is a necessary perquisite to building actual useful software. It keeps you’re data organized and relational, and it will save you hours of heartache.
Thanks for reading!
Originally published on Medium.