[RDB] E-R Diagram Mapping

Seongho·2022년 10월 27일
2

RDB

목록 보기
6/6
post-thumbnail

E-R Diagram Mapping

E-R Diagram을 관계형 데이터베이스 schema로 변환하는 것이다.
규칙(순서대로)
Step 1: Regular entity types and single valued attributes
Step 2: Weak Entity Type and Single Value Attribute
Step 3: Binary 1:1 Relationship Type
Step 4: Regular binary 1:N relationship type
Step 5: Binary M:N relationship type
Step 6: Ternary or higher relationship types
Step 7: Multi-valued attribute

Step 1

레귤러 엔티티와 single value attribute를 매핑한다. 복합 attribute의 single value attribute까지 포함해야 한다.

Step 2

Weak 엔티티와 single value attribute를 매핑한다. 연결된 레귤러 언티티의 PK와 Weak 엔티티의 partial key가 합쳐져 Compound key가 된다.

Step 3

binary 1:1 관계에서, FULL Participation이 있는 쪽 엔티티가 S이다. T에 있는 PK가 S에 FK로 들어가고 relationship에 있는 attribute를 S에 넣어준다.

Step 4

Regular binary 1:N 관계에서 N쪽이 S이다. T에 있는 PK가 S에 FK로 들어가고 relationship에 있는 attribute를 S에 넣어준다.

Step 5

binary M:N 관계에서 relationship이 테이블이 되고 S가 된다., 연결된 엔티티들의 PK를 FK로 받아와 PK처럼 쓴다. relationship에 연결된 attribute를 S에 넣어주면 Compound key가 된다. 만약, Compound key가 unique하지 않은 경우, 옆 attribute까지 추가하여 PK처럼 사용한다.

Step 6

한 relationship에 3개 이상 엔티티에 연결된 경우, relationship이 테이블(S)이 되고 연결된 모든 엔티티의 PK를 FK로 받아와 Compound key가 된다. 또한, relationship에 있는 attribute를 S에 넣어준다. 만약 1:N:N 인 경우, 1쪽에 있는 PK가 빠지고 나머지 두개가 Compound key가 된다.

Step 7

multi-value attribute(다치 애트리뷰트)의 경우, attribute가 테이블(S)이 되고 이 attribute가 연결된 엔티티의 PK가 FK로 들어온다.

최종 완성

profile
Record What I Learned

0개의 댓글