incastle의 콩나물

Database Concepts Chapter 5. Database Design 본문

19-1 대학 수업/데이터베이스 이론 및 실습

Database Concepts Chapter 5. Database Design

incastle 2019. 6. 1. 14:48

데이터베이스 이론 및 실습 정재윤 교수님 수업 (19-1)

 

Representing Entities with the Relational Model

- Create a relation for each entity

- Specify a primary key

- Specify column properties

- The relation is then analyzed using the normarlization rules.

- As normalization issues arise, the initial relation design may need to change

 

Normalization Review : Modification Problems

- Insertion, modification, deletion

 

(chapter1에서 적었던 내용 참고)

List Modification Issues

- Deletion problems : 진행중인 프로젝트만 남기고 싶어서 지음 -> 프로젝트 매니저 정보도 날라감

- Update problems : 매니저 신상 정보가 변경되면 모든 매니저 신상 정보를 변경해야 함

- Insertion problems : 매니저 정보만 추가하고 싶은데 진행한 프로젝트가 없음

 

Functional dependency 특정 attribute의 조합을 알면 다른 어떤 값이 자동으로 결정되는 관계

Determinant : functional dependency 관계에서 key가 되는 attribute

candidate key : 하나를 알면 테이블에 있는 나머지 모두를 알게 되는 key

 

Normalization

- 목표 : 모든 determinant는 candidate key여야 한다.

 

Denormalization

- 모든 determinant가 candidate key가 되게 하는 게 때로는 쓸데없이 data table을 늘릴 때가 있음.(문제를 복잡하게 만든다)

이런 경우에 말이다

 

Representing Weak Entities

- not ID-dependent & strong entities => 동일한 테크닉

- ID-dependent => must add primary key of the parent entity.

 

database로 디자인 하기!

- 1:1 관계

>> 어디에 foreign key를 넣던지 상관이 없음.

- 1:N 관계

>> 1의 primary key를 N의 foreign key에 박는다. 

 

 

- N:M 관계

>> 두 테이블을 연결하는 intersection table을 생성한다.

>> An intersection table has a composite key consisting of the keys from each of the tables that it connects.

* intersection table이 FK들을 primary key로 하고 추가 정보를 갖는 column을 갖고 있는다면, 이 관계를 association relationship이라 한다. 

 

 

- Supertype/Subtype 관계

>> Supertype의 identifier가 primary key가 되고 이 key들이 subtype에서 foreign keyd와 primary key로서  동시에 작동을 한다. 

일부는 strong entity, 일부는 weak entity

- Recursive 관계

>> 동일하게 1:1, 1:N, N:M을 갖고 동일하게 표현은 하는데... 한 번 살펴볼까?

Comments