관계형 데이터베이스

데이터가 중복되어 나타나면 개선할 것이 있다는 강력한 증거이다.

  • topic

id

title

description

created

author

profile

1

MySQL

MySQL is ...

2018-01-01

dahye

developer

2

ORACLE

ORACLE is ...

2018-01-01

dahye

developer

3

SQL Server

SQL Server is...

2018-01-15

mimi

database administrator

4

PostgreSQL

PostgreSQL is ...

2018-01-20

taeho

data scientist

기존의 테이블은 테이블만 보고 직관적으로 알 수 있다.

테이블 분리하기

  • author

id

author

profile

1

dahye

developer

2

mimi

database administrator

3

taeho

data scientist

  • topic

id

title

description

created

author_id

1

MySQL

MySQL is ...

2018-01-01

1

2

ORACLE

ORACLE is ...

2018-01-01

1

3

SQL Server

SQL Server is...

2018-01-15

2

4

PostgreSQL

PostgreSQL is ...

2018-01-20

3

테이블을 쪼개게 되면 별도의 테이블로 보관해 중복된 데이터를 저장하지 않는다.

테이블명 변경하기

테이블 분리해 생성하기

  • author

  • topic

JOIN

  • author_id와 id 가 두개다 나오므로 한개만 나오게하기

  • id를 topic_id로 바꾸기

Last updated

Was this helpful?