I've got a pop quiz for you.
What database system has been around
for almost 50 years?
I guess you can guessed it by the
topic of this video.
It's a relational database.
Hello, my name is Jamil Spain,
Developer Advocate with the IBM
Cloud and Brand Technical
Specialists in the U.S.
Financial Services market.
And today's talk, we're going to
dive a little bit into relational
databases.
I'm going to get into some of the
characteristics of the database
model and also some benefits
that it provides for you when making
your decision that you want to use
this for your next project
to get started.
Let's talk about the structure
of a relational database
system.
It's going to pretty much map
out your data points
and bring out the relationships
in that. And the way that it
accomplishes that is through.
The first thing is making tables,
which represents particular
items or nouns or particular
entities of your particular
system that you want to actually
prototype. So let's say I
have a bunch of books.
Now this is going to be a table.
It accomplishes the attributes
of these books by having columns
and columns will be things like
name.
Date.
OK, maybe author.
Of course, got to have a author for
a book and every.
Table is going to have an ID, feel
some way to uniquely identify
it. Each each row
of this.
Database table represents an
actual record or an item,
a type of book.
That's how it really fulfills
that ability to hold the database
system there.
And then as you wait, you
kind of query out this particular
system is through what we call a
you will a structured query
language.
And it's a particular system, you
can say select.
All the books.
And give me all this data out
for me to use.
Now we have one particular item
here books, but where it really
comes, you really see the power of a
relational database.
Let's say now I want to
show the authors.
And the way that relational
databases can really provide
the structure of relating these two
entities together is by
describing them through a
particular entity or relationships.
You have one that you're here about
where books can have multiple
authors, so maybe a one.
To many.
You can have a one
to one.
And just a couple of relationships
you can you can kind of mirror
within the database system, so one
way that I can have this kind of a
normalized structure is to say
definitely the authors
is going to have.
Its own particular ID
and name any, any any
any particular order of attributes
that I want to describe there,
but I can also one of these fields
can be an actual number
that actually relates to the ID.
Of this feel, and this is what's
known as a foreign key.
And of course, there will be a name
there, so when I do my query, the
next query I do, I
can reference both these tables
and say, Hey, give me all the books
and give me more of the author
information from this table using
this foreign key to
describe that particular structure
there.
And you can imagine you'll be
running a lot of these queries a
lot, and there are some benefits
or some things that are provided to
help with those to speed
up these queries and make them
operate as efficiently as possible.
You have the database will provide
ways that you can kind of set an
index. Let's say that I'm often
querying and always trying to pull
out by name or by date.
I can set an index.
On this particular column,
which will automatically index all
the values, so the next time you
run, this query is going to pull
from what we like to call this cache
of all the values.
Most importantly, every
time new roles are added,
records are added to this particular
table. The index keeps building
this recent, I like to say,
cache of all these values, so it's
always keeping up to date
to work there.
So this is all the characteristics
of what you kind of have to model
out your particular
application that you want to build
and describe how the entities
are related to each other.
Now let's switch over here to some
of the benefits that you're going to
get out of the box with
a relational database
that you want to use.
The first we'll talk about
is actual
consistency.
Now, this is useful because let's
say there is some point where I want
to run multiple of these
transactions.
Let's say I'm modeling an inventory
system for an E commerce
application, and I have the need
to write several
queries in a row that may
manage a couple of
different subsystems.
But if one of those queries fails,
I want the option to be able
to roll back.
The whole set of all
those queries, just to make sure
that my data always maintains
some consistency there.
The second is the option
to do stored procedures.
Sounds like a very complicated
word there.
But think of store procedures as
the ability to write multiple blocks
or functions of code,
or if there are a certain amount of
queries that I continue to always
run, I can kind of model
these. So it takes me less
code to write that particular
to access that same functionality
with less SQL code.
And as you start to get into more
SQL writing with
relational databases, you'll see
queries can get pretty big.
Another way
you can do this, as well as another
topic code views here.
Definitely want to introduce some of
these keywords as you do your deeper
dove. You were able to see a lot
of these and it'd be familiar
to you.
And the last one is a mechanism
to handle locking
in the database.
And concurrency.
Why is that important?
Well, at some
point multiple users are going
to want to use the database, maybe
at the same time, maybe two
applications are going to be adding
in books.
And if the first application
is making a particular
insert into this table.
You're going to want to make sure
that the database is locked until
that right is done and then
the second application has its
ability to go in and make its insert
as well.
So these are all built into
a lot of the relational databases
that you use.
A lot of these benefits will be
provided for you out of the box, not
necessarily something you'll have to
write in code, but just know
that you'll have this at top of mind
when you are kind of selecting
to use a relational database for
your next project.
I hope this is good for you to
understand the foundation of
relational databases.
Talk to you next time.
If you have questions, please drop
us a line below.
And if you want to see more videos
like this in the future, please
like and subscribe.