데이터 베이스 사전 조사

Minhyeok Kim·2022년 7월 31일
0
post-thumbnail

This language is more popular than java and the python .
It is a language that just by understanding it will help us so much when building a web related product also it is a great on the CV and it could save you so much on a technical interview the crazy part is that is not even a programming language this language that we are going through for next 2 weeks is SQL.

SQL means, a Structured Query Language.
It is a language specifically designed to talk to databases as we know almost everything needs a database. Databases are where we store our data so we need to understand as developers how to actually talk to databases.

In the database category, there are two types of database categories. First, relational databases, second, Non-relational databases also known, SQL and Non-SQL.
On the SQL corner, we have stuff like MySQL, PostgreSQL, SQLite and on the non-SQL corner, we have things like MongoDB dynamoDB and couchDB.

SQL databases have been the default choice for most companies, Governments, Banks, Enterprise legacy systems. that is why the SQL is the industry standard.

Then, how do SQL databases look like, and how do they work ?

a SQL database looks just like an Excel document.
A database has tables, and an Excel document has sheet. Both have columns and rows.

Looks like,

사용방법은 그냥 영어로 말하듯 하면돼

그런데 왜 개발자들은 SQL을 잘 모르는 경우가 많을까 ??
그 이유는 ORM 떄문인데 이게 뭐냐면, 파이썬으로 코딩을 해서 ORM을 태우면 SQL로 바꿔주기 때문에 SQL을 잘 알필요가 없었던 거지 그래서 개발자들은 SQL -> 파이썬, 파이썬 -> SQL 을 바꿔가면서 코딩하는 것보다 하나로만 해서 비꿔주는게 편하니까 익숙하지 않았던거야

사실 이러한 보조 툴들을 사용하면 시간을 아낄 수 있기 때문에 좋지만, SQL 언어에 대한 이해가 부족하다면 실제로 문제가 발생되거나 중간에 break 되면 root cause 를 찾기가 어려울 때가 있어 그래서 SQL을 쓸 수 있다는건 개발자한테 굉장히 큰 부분이라는 거지

So, it is not saying that we should become a SQL expert. it is just saying we should understand at least how SQL works so at least we understand what our ORM is doing for us. This will help us understand how databases work it will help us model our data if we just learn a little bit of SQL.

SQL vs Non-SQL
이건 그냥 database 의 카테고리를 나눴다기보다는 부분적으로 갈라놓았다라고 보면 돼
예를 들면 SQL은 한국음식, Non-SQL은 한국음식을 제외한 나머지 나라음식??

Non-SQL database
여기에는 크게 3가지 종류의 database가 있는데,
1. Document DB
2. Key value DB
3. Graph DB

첫번째로 Document DB
Document DB 의 가장 큰 예시는 mongo DB 인데 이건 데이터를 json document 형태로 저장을 해 한마디로 컬럼고 열이 존재하지 않고 저장을 하는거지. 그래서 어떤 형태로든 저장이 가능하지

두번째로 Key value DB
Key value DB 에는 Cassandra DB, Dynamo DB 가 있는데 카산드라 DB 는 굉장히 빨리 읽고 쓰고가 가능해. 그래서 애플이 카산드라를 이용해 저장하기도 하고 넷플릭스, 우버, 인스타그램과 같은 회사들도 사용하고 있지. 왜냐하면 이런 회사들은 엄청 많은 양의 데이터를 빠르게 저장해야하니까. 다이나모 DB 는 서버리스, 즉 분산된 Key value DB로서 아마존이 만들었어 이 역시 엄청 빠르게 쓰고 많이 읽는데 특화가 되어 있지
Key value DB는 뭔가 엄청 빠르게 읽고 쓰고 저장하는데 특화가 되어 있어

세번째로 Graph DB
이건 컬럼이나 document가 굳이 필요는 없지만 노드들 사이에 관계들을 알아야할 때 도움이 돼. 예를 들어서 소셜네트워크를 만든다면 (페이스북같은) 각각의 entity 를 저장하고 이를 관계망으로 연결해서 유저들의 사진이나 좋아요 그리고 친구사이 같은 정보들을 잘 표현해야겠지? 이를 support 할 때 graph DB 가 좋아

이 내용들은 노마드코더라는 채널을 운영하고 있는 Nicolas의 영상을 보면서 읽어내듯 써본 내용
공부하자...

++++ 추가내용

SQL 과 NO-SQL 의 가장 큰 차이점은
SQL 은 잘 정돈된 데이터들의 집합상태라 잘 설계된 DB 라면 각각의 정보들이 연결이 되어있어서 저장과 활용측면에서 이점이 있다. NO-SQL 에서는 JOIN 을 쓰지 않고 각각의 정보를 가져올수 있는데에 있다. 즉, DATABASE 의 정보를 필요한 데이터로 가공할때 건들여야하는 데이터가 줄어들기 때문에 속도측면에서 이점이 있다.

0개의 댓글