데이터 중복을 제거.
> 데이터가 많아지면 많아질수록 처리 속도 (퍼포먼스) 와 유지보수가 어려워짐
하나의 표에서 직관적으로 데이터 항목들을 볼 수 있는 장점을 버리는 효과
> 하지만 우리가 상상하는건, 수없는 데이터의 집합
> SQL 을 통해 한눈에 데이터를 볼 수 있는 명령도 가능
관계형 데이터 베이스의 꽃.. JOIN
A. join point 를 찾아라!
B. 아래 예제에서는, author_id of topic == id of author
TABLE JOIN
mysql> SELECT*FROM topic LEFT JOIN author ON topic.author_id = author.id;
topic table의 왼쪽에, author table을 join 시키는데, 기준은 [topic table의 author_id == author table의 id]
JOIN : delete useless column
mysql> SELECT topic.id, title, description,created, name, profile FROM topic LEFT JOIN author ON topic.author_id = author.id;
JOIN : change cloumn name
mysql> SELECT topic.id AS topic_id, title, description,created, name, profile FROM topic LEFT JOIN author ON topic.author_id = author.id;
Change some items
mysql> UPDATE author SET profile='database administrator' where id = 2;
'BeADeveloper > DBstudy' 카테고리의 다른 글
MySQL 기초 2 : INSERT, SELECT, UPDATE, DELETE (0) | 2019.07.12 |
---|---|
MySQL 기초 1 : Create (0) | 2019.07.11 |
MySQL 기초 : SQL 개념정리 및 Create / Read (0) | 2019.07.11 |