Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Learn what a relational database is.
Prerequisites
Terms
- Relational Database - A database structured to recognize relationships between items
SQLAlchemy Docs
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Hi, my name is Megan, and
I'm a teacher here at Treehouse.
0:09
In this workshop we're going to dive into
relational databases using SQLAlchemy.
0:13
Make sure you're familiar with
SQLAlchemy before moving on.
0:18
Check the prerequisites and
teacher's notes below.
0:22
Before we jump into the code,
let's chat about what relational means.
0:26
Let's think about a real-life scenario.
0:32
Let's say you work for a small business,
you probably have a list, or
0:34
spreadsheet, or
database of your customers.
0:39
Now, if a customer makes a purchase,
0:42
you might think about adding
on to the table like this.
0:44
But over time, this would probably
get confusing and hard to follow.
0:49
Instead, you can break this
up into two tables, and
0:56
then create a relationship
between the two.
1:00
In the second table, you can see there
is a column for the customers ID.
1:04
IDs are always unique, since this is
the primary key of the customer table.
1:09
This is called a foreign key.
1:15
It lets your database know there's
a relationship between these two tables.
1:17
These foreign keys are shared
attributes between the tables.
1:22
Now that we have a quick overview
of a relational database,
1:27
I find playing around in the code
helps solidify the knowledge.
1:31
So in the following videos,
let's create our own relational database.
1:35
Don't forget to check
the teacher's notes as you go.
1:40
Let's get started.
1:43
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up