DataBase

소바·2022년 8월 30일
0

What is a database?

what a database is a system, hardware and software that allows a user to store, organize and use data.

A database is a collection of data and also a method for us to access and manipulate that data.

They capture this data for us so that we can use it.

But the secret is that databases aren't anything special, they're just hardware and software,
We learned that a database is essentially a computer with some database software on top.

excel

You see, the problem with things like Excel is that eventually you'll get to a point where you have too much data where an Excel or a spreadsheet just can handle it.

DataBase

Now, in discourse, the way things are going to be structured is because we have data coming from all over the world, all different places.

We have all this data coming in and this data coming in can be images, can be user profiles, can be audio files, can be logs of information of statuses.

And we learned that we need to learn how to put this data in a database, how to use update, learn from this data, and also possibly how to remove this data.

DBMS (DataBaseManagementSystem)

The first one is DBMS, or a database management system, a database management system is a software.

It's a program that is used to manage the database.

It receives instructions from somebody like us that wants something to do with data and instructs the system, the database to make this to actually grab the data or make changes to the data.

What can it do?

So if we look at what a database management software system can do while we're talking about create, read, update or delete crud operations, OK, let's take a step back here.

So each chef has their own, quote unquote, database of cooking, and they may all store the data in their head slightly differently.

And the database management system is taking your query and figuring out, OK, I need to talk to this database and I need to go to this hard drive to get the data.

RDBMS

And then we have relational database management system.
This is a subset of database management system, what we're going to learn about is something called relational databases, and they're the most used, the most common, the most popular type of databases.
And in my opinion, the most useful things like my school, askew light, PostgreSQL, Microsoft server, Oracle, all use this relational database management system.

But a relational database is a database that allows us to set up connections among different data records.

RDBMS being your referee(=judges), being your security, implementing the specific rules that you need to follow.
There are 13 rules that needed to be followed in order for a database management software to be considered a relational database management software.

**They're basically rules that need to be followed to build a database management software. They are the rules that the database management software is going to enforce on you when you get an error, when you're trying to do something that doesn't follow these rules That's what the database management software is doing.

It's following these rules in order to give you some constraints and give you a way to save in a relational way.**

SQL

And then finally, why you're taking this course is SQL or a structured query language.

SQL is a language that we will be using to talk to our databases.
It's a way for us to interact with a database management system.

It's not really a programming language, it's a query language where ask you, well, its role is to give us the ability, like all the people that we saw, like product managers, like business analysts,like data engineers, like web developers to communicate with these databases using a very simple language school that is very English like.

But the beauty is that when you learn you well, it doesn't just work with one database management system.

why database is useful than excel

There's a minus one here and in his head has to keep track of all these things, all these changes, and imagine having more and more rows.

And this is why databases exist.

Instead of this, let's imagine a better system that Jeff implements now for you.

use ask you all statements and we grab information that we need.
But it's not just one big Excel file, right?
There's different pieces of data.

limitation of file processing system


how redundant data, isolated data and the file structures in which the data were stored were problematic for systems to talk to each other and for users to be able to understand how to manage their data.


And comes the database oriented approach as the process started outweighing the cons.

data를 파일로 관리할 경우 각각의 파일들의 data model이 달라져서 관리가 힘들다
그래서 Database가 등장했다

What is SQL?

Well, SQL is a language that we will be using to talk to our databases.

we are using to talk to a system to get a specific output and output being an answer. In this case, we're asking for data.

And SQL is going to be the language that we're going to be utilizing to talk to the database, to pull data, to insert data and so forth.

Now, a database is nothing more than a structured set of data.

There are different structures that you could basically apply to data.
Well, heck, we could take a notepad and we could write a book in there, or we could take an Excel sheet and make a personal budget.

history of SQL

Well, sequel was the original name, and it stood for structured English query language, but it had to change its name due to copyright conflict.

Query

And when we use our SQL, we are going to be writing statements, statements being instructions that we're going to give to the database to give us back data.

These are called queries.
So in the previous video, we ended on talking about queries, a query is nothing more than an instruction
A query is defined as a question and then ask you, Well, queries are the way that we are going to put together our questions to which we want an answer from the database.

A query is also known as an SQL statement.
Query is equal to ask you all statement as you will statement is equal to a query just different ways of saying the same thing.


So if we look here, there is a very basic query select star from users.
And if we were to break this down, what it's basically saying is select us all of the information.
So the star here is what we call a wildcard.
We don't know what we want to get back, but just get us everything back.

Query Breakdown


We're filtering data at this point.
We're seeing where the role is equal to manager of the user Give us back their name.

So each line here is called a clause and when we see select name name is called an identifier.

An identifier is just a different word for a part of the data.

And when we look at the last line where roll is equal to manager our filtering line.

But the line role equals manager is called the condition, so a condition is something that needs to
A user has a role that role needs to be equal to manager in order for us to get some data back.

We are expecting that some of the roles may be equal to a manager, but some may not be.
So that's why we call it an expression, because we are making an assumption here that some of the roles are equal to manager.

We want to filter based on our assumption.

Because now we've just said select name from users where role is equal to manager.
We asked a question and we got an answer back.

This is what we call a declarative language.

columns

rows

primary key & forign key

5 types of DATABASE Model

let's talk about the five kinds often called the five data models.

Relational Model

One is the relational model.
This is the one that we kind of saw with MySQL and PostgreSQL.
They support something called asset transactions.

So you'll see these types of databases in a lot of e-commerce websites, a lot of websites that have customers or users inside of businesses.

Document Model

Next is a document model, a document model database.
You may have heard of things like MongoDB, Couch DB or Firebase. They use what's called a document model.

And in this case, data is almost in a document rather than rows and columns like we saw in the Amazon
These databases are usually a big document that contains a ton of related information.
Together, these types of databases are usually really, really good at what we call scalability databases that have to hold more and more data that have to be more and more performant.

Key value Model

Then we have key value databases.
Now you may have heard of things like Redis at CD or Dynamo DB. These are key value storage systems.
It's a model that is one of the simplest ways to access data.
You essentially have a key that is, Hey, I want to get User ID one and you get User ID one back.

Graph Model

Then we have graph model databases.

These are databases like Neo4j or A.W. Yes, Neptune.
These types of databases are a lot rarer because they're a little bit more complex and they use something called a graph model.
That is, it's really good for data that is connected in different ways.

That is, it's really good for data that is connected in different ways.
So a social network website might have graph databases because they want to see how different users are connected to one another.
Out of all of these graph databases are probably one of the least used because they are so specific.

Wide Columnar Model

And then finally, we have something called wide columnar model.
These wide columnar models are fairly new, and they were pioneered by Google's big table databases.
Like Apache Cassandra, Google's big table are very popular now, all linked to a resource if you want to dive a little bit deeper into what these differences are.

Document model DB(MongoDB)

Mongo DB vs SQL?

In terms of Schema

Data Base Scaling strategy

Vertical Scaling & Horizontal Scaling

Sharding

relational model

업로드중..

So by linking their unique identifier s together in a separate table, we can now say, Hey, this author and this book is related, and by retrieving all the authors for a book, we could potentially now say, Oh, this book has two authors.
So by storing all our data in a flat way unrelated to parent and child like structure, we can now draw relationships in a much simpler way.
The logic of how the relationships are linked are managed by the database

profile
소바보이

0개의 댓글