Table(Relation)
- 행과 열의 2차원 구조를 가진 데이터 저장 객체
Column(Field, Attribute)
Row(Record, Tuple)
- 테이블에서 가로 방향으로 이루어진 연결된 데이터
Relational Model Constraints
1) 도메인 제약 => 속성에 대한 제약
- 속성 값은 원자성을 가지며 도메인에서 정의된 값이어야 함.
NOT NULL
이 아닌 경우 NULL
값은 허용됨.
Composite attribute
와 multivalued attribute
는 허용되지 않음.

2) 키 제약 => 릴레이션에 대한 제약
- 릴레이션의 모든 튜플은 서로 식별 가능해야 함.

cf) Super Key, Candidate Key, Primary Key
3) 개체 무결성 제약 => 기본키(Primary Key)에 대한 제약
- 기본키는
Unique
& Not Null
이어야 함.

4) 참조 무결성 제약 => 외래키(Foreign Key)에 대한 제약
- 릴레이션 R1이 릴레이션 R2를 참조하는 경우, R2의 기본키는 R1에서 외래키로 사용됨.
- 외래키는 자기 자신이 속한 릴레이션을 참조할 수도 있음.
NULL
이거나 NULL
이 아닌 경우 R2에 실제로 존재하는 값으로 구성되어야 함.

ER-to-Relational Model 변환 규칙

Step 1: Mapping of Strong Entity Types
- 각 strong entity E에 대응되는 릴레이션 R을 생성함.
- E의 Single-valued/Simple/Stored attributes를 모두 R의 속성으로 포함시킴.
- Composite Attributes의 경우 각 하위 컴포넌트만 포함시킴.
- Multivalued Attributes는 추후 고려.
- E의 키 속성 중 하나를 선택하여 R의 기본키(Primary Key)로 정함.
- Composite Key의 경우, 이에 속한 속성들의 조합이 R의 기본키가 됨.

Step 2: Mapping of Weak Entity Types
- 각 weak entity W에 대응되는 릴레이션 R을 생성하고, W의 Single-valued/Simple/Stored attributes를 모두 R의 fields로 포함시킴.
- W의 식별 개체 E에 대해서, E의 기본키를 R의 외래키로 포함시킴.
- R의 기본키는 E의 기본키와 W의 부분키(Partial Key)의 조합으로 구성.

Step 3: Mapping of Binary 1:N Relationship Types
- 각 Binary 1:N Relationship RS에 대해, 이 Relationship에 참여하는 두 entity를 각각 S(N-side)와 T(1-side)라고 하면 T의 기본키를 S의 외래키로 포함. RS에 속한 모든 simple attributes S에 포함시킴.

Step 4: Mapping of Binary 1:1 Relationship Types
- 각 Binary 1:1 Relationship RS에 대해, 이 Relationship에 참여하는 두 entity를 각각 S와 T라고 하면:
- (대안 1) T -> S 방향
- T의 기본키를 S의 외래키로 포함
- RS에 속한 모든 simple attributes를 S에 포함시킴.
- (대안 2) ST 방향
- S의 기본키를 T의 외래키로 포함
- RS에 속한 모든 simple attributes를 T에 포함시킴.

Step 5: Mapping of Binary M:N Relationship Types
- 각 Binary M:N Relationship RS에 대해, 이 Relationship에 참여하는 두 entity를 각각 S와 T라고 하면:
- RS에 대응되는 새로운 릴레이션 R을 생성함.
- RS에 속한 모든 simple attributes를 R에 포함시킴.
- S와 T의 기본키를 R의 외래키로 포함.
- R의 기본키는 S에서 온 외래키와 T에서 온 외래키의 조합으로 구성.

Step 6: Mapping of N-ary Relationship Types
- 각 N-ary Relationship RS에 대해, 새로운 릴레이션 R을 생성함 (N>2인 경우에 해당됨).
- RS의 모든 simple attributes를 R의 속성으로 포함시킴.
- RS에 참여하는 모든 entity의 기본키를 R의 외래키로 포함시킴.
- R의 기본키는 모든 외래키의 조합으로 구성됨. 단, 대응수가 1인 관계로부터 가져온 외래키는 기본키의 조합에서 빠짐.

Step 7: Mapping of Multivalued attributes
- Entity E에 속한 multivalued attribute MA에 대해 릴레이션 R 생성.
- MA의 속성을 R에 포함시킴 (attribute A).
- E의 기본키 K를 R의 외래키로 포함시킴.
- R의 기본키는 K와 A의 조합으로 구성됨.

주의: 중복 정보 발생
- 중복 정보 발생 시 update anomaly, insert anomaly, delete anomaly 발생 가능.
예시 Case
