Database) Chapter7. ER Model
Chapter 7: Entity-Relationship Model
기본적으로 database는 entities의 collection과 entities들 간의 relationship으로 modeling 되어 있다.
entity는 다른 object와 구별가능한 하나의 object이다.
entity는 각각 attribute를 가지고 있다.
entity set은 같은 특성을 공유하는 같은 type의 entities set을 의미한다.
Relationship은 several entities들 간의 association을 말한다.
Relationship set은 두 개 이상의 entities들 간의 수학적 relation을 의미한다.
Attributes
Domain : the set of permitted values for each attribute
attribute types: simple and composite attributes.
single-valued and multivalued attributes
derived attributes
=> composite attribute(name: first_name, middle_initial, Last_name)
=> multivalued attributes(nickname: dog, cat, ...)
Relation은 attribute끼리 Mapping을 시키는 것. binary relationship set에서 cardinality는 반드시 다음 중 하나가 되어야 한다.
one to one -many to one
one to many -many to many
Relation에 하나만 대응되는 attribute는 화살표로 define되며, many로 대응되는 attribute 같은 경우 화살표가 존재하지 않는다.
Keys
super key of an entity set is a set of one or more attributes whose values uniquely determine each entity
Candidate key는 minimal super key.
Primary key는 그 Candidate key 중에서 특별히 선택된 key.
=> Combination of primary key of the participating entity set은 relationship set의 super key를 형성한다
E-R Diagrams
Rectangles represent entity sets
Diamonds represent relationship sets
Attributes listed inside entity rectangle
Underline indicates primary key attributes
(ex) <!--[endif]-->
Entity with Composite, Multivalued, and Derived Attributes
instructor
ID
name
first_name
middle_initial
Last_name
address
street
street_number
street_name
apt_number
city
state
zip
{ phone_number }
date_of_birth
age() // derived attributes
Relationship Sets with Attributes -> Relationship에 연결된 사각형
Entity Sets of a relationship need not be distinct -> 각각 선으로 relation상에서 어떠한 역할을 맡는지 작성 => Role
Participation of an Entity Set in a Relationship Set => Total participation (indicated by double line): every entity in the entity set participates in at leat one relationship in the relationship set (entity의 모든 row가 relation에 참여해야 한다.)
An entity set that does not have a primary key is referred to as a weak entity se => weak entity set은 identifying entity set으로 결정됨. Identifying relationship은 double diamond를 이용함
Discriminator는 attribute의 set으로 weak entity set들간을 구분하게 한다. Weak entity set의 primary key는 strong entity set의 primary key + weak entity set의 discriminator로 이루어져 있다.
Extended ER Features : Specialization
lower level의 attribute는 해당하는 attribute만 가지고 있는게 아니라 조상 Entity의 속성을 가져옴. => 만약 자손 entities가 각각의 화살표로 조상을 가르킬 때, 조상은 자손의 속성을 둘 다 가질 수 있음
만약 화살표가 하나로 뭉쳐 조상을 가르키면, 자손 중 하나만의 속성을 가져야만 한다는 뜻임. (disjoint)
댓글
댓글 쓰기