Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Data Relationships with SQL and Sequelize!
You have completed Data Relationships with SQL and Sequelize!
Preview
You describe the data for your application using the "nouns" that you've identified. And you represent the nouns in your database using multiple tables. The associations between tables are known as "data relationships".
Resources
- Sequelize docs
- Upgrade to Sequelize v6, the next major release after v5
Related courses and workshops
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, everyone, I'm Guil, a developer and
instructor here at Treehouse.
0:09
In this course, you'll learn how to
define data relationships using SQL and
0:13
Sequelize.
0:17
A Node.js ORM or Object-Relational Mapping
library for SQL databases.
0:18
You've learned that a SQL database
is called a relational database.
0:23
The database structure which
you organize into tables.
0:27
Allows you to store,
access, and connect data,
0:30
in relation to other data in the database.
0:33
That way you can think about and use data in terms of
0:36
related sets as opposed to
individual values or rows.
0:39
For example,
when designing an applications database,
0:43
it's a common practice to start by listing
all of the things that the application
0:46
will be working with.
0:50
Or all of the nouns.
0:51
Imagine that you've been tasked with
creating an application like IMDb,
0:53
that will allow users to
view a list of movies.
0:57
Each movie will display its title,
release year, director's name,
1:00
and optionally the primary actors' names.
1:04
You identify your first noun as movie,
which will have title and
1:07
release year attributes or properties.
1:11
But what about the movie's director and
actors?
1:13
Do you add additional movie properties?
1:16
Or do you treat directors and
actors as separate nouns?
1:19
Director and actor for example.
1:22
They'll both have firstName and
lastName properties.
1:24
So you decide to think of a director,
or actor, as a single noun: person.
1:26
You can describe the data for
your application
1:31
using the nouns that you've identified for
your application, movie and person.
1:34
And you represent the nouns in your
database using multiple tables.
1:38
There are also relationships
between your nouns or tables.
1:42
For example, a movie will be associated
with a person as its director,
1:46
and a movie will be associated with one or
more people as its actors.
1:50
These associations between movie in
person, are known as data relationships.
1:54
As you follow along in this course, you're
going to define data relationships for
2:00
a simple node application that creates and
retrieves movie data.
2:04
You'll define data relationships and
Sequelize models, and
2:08
create related data,
2:11
like movie and
person records. using those models.
2:12
Then you'll retrieve related
data with Sequelize queries.
2:16
To get the most from this course, you
should be familiar with SQL and Sequelize.
2:19
If you need a refresher,
review the Treehouse courses and
2:24
workshops posted in the teachers notes.
2:27
Next, you'll start exploring data
relationships in a Sequelize database,
2:30
why they are useful, and
the different types of relationships.
2:34
Then you'll download and
run the Node.js project,
2:38
and begin creating data
relationships using Sequelize.
2:40
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