본문 바로가기
Computer Science/Database Systems

[Database Systems] ER to Relational model

by __K.Jun__ 2025. 1. 26.

Mapping of Regular Entity Types

각각의 Regular entity -> relation

Attribute: Entity type의 모든 simple attributes(Composite 또는 multivalued가 아닌 것들)

Primary key: Entity type의 Key attribute 중 선택

Mapping of Weak Entity Types

각각의 Weak entity -> relation

Attribute: Entity type의 모든 simple attributes, Identifying owner의 PK를 FK로 저장.

Primary key: Entity type의 Key attribute(partial key) 중 선택해서 FK와 합친 것이 PK

Mapping of Multivalued Attributes

Multivalued attribute -> 자체를 하나의 새로운 relation으로

Attribute: Multivalued attribute, 이 attribute를 가지고 있는 Entity의 key attribute를 FK로 가진다.

Primary key: 모든 attribute를 합친 것(= Multivalued attributes + FK)

Mapping of Composite Attributes

Composite attribute -> 자체를 하나의 새로운 relation으로

Attribute: Component attributes, 이 attribute를 가지고 있는 Entity의 key attribute를 FK로 가진다.

Primary key: FK

 

또는

 

Component attribute들을 이 Composite attibute를 가지고 있는 entity의 relation의 attribute가 되게 한다.

Mapping of Binary 1:1 Relationship Types

참여하는 Entity 중 하나를 선택해서, 한 쪽이 반대 쪽의 PK를 FK로 갖게 한다.

공간 절약을 위해서 FK가 NULL인 경우를 없게 하는 것이 좋기 때문에, total participation하는 쪽이 FK를 갖는 게 좋다.

relationship type의 모든 simple attribute를 한 쪽에 몰아 넣는다. 

Mapping of Binary 1:N Relationship Types

1:N에서 N인 쪽이 1인 쪽의 PK를 FK로 갖는다. relationship type의 모든 simple attribute를 N쪽에 몰아 넣는다.

Mapping of Binary M:N Relationship Types

새로운 독립적인 relation 하나를 만든다.

Attribute: 양 쪽의 PK를 FK로 저장한다. relationship type의 모든 simple attribute를 attribute로 갖는다.

Primary key: FK들의 조합

Mapping of N-ary Relationship Types

새로운 독립적인 relation 하나를 만든다.

Attribute: PK들을 FK로 저장한다. relationship type의 모든 simple attribute를 attribute로 갖는다.

Primary key: FK들의 조합

 

 

728x90

'Computer Science > Database Systems' 카테고리의 다른 글

[Database Systems] SQL (1)  (0) 2025.01.30
[Database Systems] Relational algebra  (0) 2025.01.28
[Database Systems] Relational model  (0) 2025.01.19
[Database Systems] ER Diagram  (0) 2025.01.11
[Database Systems] Requirements  (0) 2025.01.08