Overview of DB Design Process

요구사항을 잘 파악해서 디자인하는 것이 중요하다.

 

ER Model Concepts

Entity Attribute Relationships
객체 속성, Entity type이라고도 한다. Entity간의 관계
Entity type Attribute type Relationship type
객체에 해당하는 attribute를 규격화한 정보이다.  Attribute의 속성을 규격화한 것이다.  Entity-entity에 대한 정보를 말한다

Entity는 "Employee", "Project" 등이고 Attribute는 "Project"의 title, member, due-date 등이다.

 

Types of Attributes

Simple Composite Multi-valued
Sigle value를 의미한다. 여러개의 attibutes로 이루어진 하나의 attribute를 의미한다.
Denoted as Name{First, Middle, Last}
여러개의 value로 표현할 수 있는 것을 의미한다. 
Denoted as {color} or {name}

 

Entity Types and Key Attributes

  • Entity는 같은 attribute를 공유할 수 있다.
  • 반면, unique한 attribute는 key attribute라고 한다.
  • Key attribute는 여러개일 수 있다.

 

Entity Set

ER diagram

각 entity type은 DB에 저장된 entities의 조합일 수 있다. "CAR"를 의미한다. 

Entity set은 현재의 저장된 state를 의미하기 때문에 entity type과 다를 수 있다.

 

Value Sets(Domain) of Attributes

Attribute에 속할 수 있는 value의 범위를 말한다. Domain이라고 한다. 

 

Relationships and Relationship Types

Relationship Relationship Type Relationship Set
2개 이상의 entity간의 관계를 나타낸다. 종류를 말하는 것으로 겹칠 수 있다. Relationship Type의 current state를 의미한다.

ER diagram에서는 다이아몬드로 표현한다.

 

Recursive Relationship Type

Relationship type은 같은데 다른 역할을 맡을 수 있다. ER diagram에서는 다음과 같이 표현한다.

ER diagram

"Employee"와 "Supervision"을 보면 1명이면 supervisor, n명이면 supervisee라고 표현하고 있다.

Weak entity는 key attribute가 없는 entity를 말하는데, 두겹의 다이아몬드로 표현한다. 당연히 weak-key도 있다.

 

Cardinality Relationship constraints 

1:1 / 1:N / N:1 / M:N 등의 관계가 있다.  이를 해석하면 Participation constraint:total이다. 즉 1:N은 1명 제한이며, 정원은 N명임을 알 수 있다.


Existence Dependency Constraints

zero: 부분참여, one: 전체참여를 의미한다. 

 

(min, max) notation for relationship constraints

얼마나 참여하는지 알기 쉽다.

 

UML class diagram

 

Relationships of Higher Degree

Entity의 수를 말하며, binart, ternary, n-ary라고 부른다. 보통 binary relationship을 유지하기 위해 노력한다.