Welcome back.
So we just left off with our friend Jeff, having a really hard time keeping track of orders, things
were getting bigger and bigger and harder and harder to manage just with a spreadsheet.
So we advised them that a database might be useful.
So how would Jeff implement a database, let's say, an Amazon?
Well, remember, a database is just software and hardware that holds that data and allows us to manipulate
that data.
So Jeff on his computer decides to install a database management system.
Let's say he picks PostgreSQL, he installs it, and then he starts putting the data that we had in
a spreadsheet into PostgreSQL, into a database.
Now, again, something that we're going to learn about throughout this course.
But for now, I've simplified the diagrams for us.
So now Amazon decides that we're going to use a database, not a spreadsheet, because our company is
growing.
So they start creating a different way to organize data.
That kind of looks like a spreadsheet, like an Excel sheet, but a little bit different.
One is we have customers that is each customer.
Now has a customer I.D., a unique customer ID that we can identify the customer with, so I'm customer
one Saulius to Brunos three MO is for the beauty of this is that if I ever moved, I have one location
where Jeff could look to see my new address.
So there's only one record of myself and my address.
So Jeff knows exactly where to ship my product.
Next, we create the products data.
So this is another table that we're creating and products just like customers.
Have an ID to uniquely identify them.
We have the description of the product, but also the price.
Again, if we ever add products to our company, to Amazon, then we can just add it all in one location
if we want to change the price or offer discounts.
We can change the price in one location.
Then, of course, we need our orders.
In order for us to make money with Amazon, we need to actually sell stuff.
So how do we keep track of orders?
Well, each order, just like we had with customers and products, are going to have a unique ID.
But this is the beauty of something like a database.
Older one who ordered the first order while customer I.D. is right here.
What's the customer ID want, so Andre ordered something.
This is when I ordered it.
What product did Andre Order?
Well, what's two product ID two is a toy duck.
OK, Andre ordered a toy duck and then the quantity is one.
So now I know exactly who ordered it, what product, how many, what the prices and also the address
to shipping.
Now pause the video and see if we can connect all of these relations for the rest of the three orders.
Once you're done, let's take a look at what we've just created.
We've essentially created relations, right, instead of having everything in one Excel sheet, we now
have these tables that link to one another.
Each table has a relation to one another.
For example, the customer IDs are matched over here.
We have the product ID that's matched over here.
All of these are related with one another connected.
And because there's only one location for us to change things, for example, let's say the address
changes, I know exactly where to update those customers.
I know exactly where to update the product or even the orders.
And this is one of the big things with the database's, especially when it comes to a relational database
where we're able to create large, massive amounts of data beyond what an Excel sheet might be able
to do, but also organize it in a way that is really intuitive, although it might be really hard for
you to understand how to look at this data right now for a computer when we start using things like,
well, a computer understands this a lot better than a confusing Excel sheet with many, many rows,
many, many cells that are not linked or connected properly.
So to finish off this video, I want you to go back to our playground over here and start seeing how
these tables are organized, for example, go to the orders table and try to figure out what this first
order was.
We see that there's an order I.D., there's a customer ID.
Find out who the customer is, who the employee is that sold this product and the shipwright, who's
the shipper?
Once you start to decipher tables like that, well, that's when things get more and more interesting.
Congratulations, we just managed to help Jeff become the superstar that he is now.
You're welcome, Jeff.
All right.
I'll see you in the next video.