Computer Science/Database

1. Data Modeling Using the Entity Relationship (ER) Model

  • -
728x90
반응형

ER Model Concepts

Entities

  • Specific things or objects (e.g. student, course)
  • Analogous to class of OOP
  • Holds Set/Collection of objects : Entity set
  • Same as table in DBMS

Weak Entity

  • An entity without a key. But has partial key
    💡
    즉 key를 가지고 있기는 하지만 그 자체만으로는 안되는 것을 의미한다. 위의 예시의 경우에는 loan이라는 entity는 반드시 customer entity를 요구하는 케이스이다.
  • Dependent on other entity (owner entity)
  • Participation: mandatory/total-participation

    → It requires at least one correspondence.

Attributes

  • Properties to describe an entity
  • Columns of a table
💡
즉, 각 entity가 어떤 특성을 가져야 할 것인지에 대한 기준을 제공해주는 것이다.
  • Elements in each entity have value for each attributes
  • Each attributes has a value set (or data type) - e.g. integer, string, data, and so on

    → Like a programming language, it has a data type

💡
It is very similar to the member variable

Types of Attributes

  1. Simple: single/atomic value
  1. Derived: Derived from another attribute
  1. Composite: Combination of simple attributes - e.g. name is a combination of first name and last name
  1. Multi-valued: Multiple values for an attribute - e.g. phone number
    💡
    Multi-valued는 원 2개로 표현한다.
  1. key: an attribute which has unique values - e.g. Social security number
    1. Composite key: Combination of attributes make it unique
      💡
      단순 composite과 다른 점은 unique를 추가적으로 얹되 combination을 해야지만 unique를 담보할 수 있다는 점이다.

      → 비유하자면 전화번호가 있다. 전화번호 자체는 겹칠 수 있지만, country code를 엮으면 unique함을 보장할 수 있는 것과 관련해서 이해할 수 있다.

Relationship

  • Relationship: relates two entities - e.g. employee works for a department

Additionally, relationships can have a lot of attributes.

Constraints on Relationships

  1. Cardinality Ratio / Ratio constraints
    • One-to-One
    • One-to-many
    • Many-to-many
    💡
    즉 entity에 속한 원소들이 어떤 식으로 대응되는 지에 따라서 분류한 것이다. 구분하는 방법은 대응되는 관계를 보면 된다. 주의할 점은 notation에 따라서 표기하는 방향이 다르다는 것이다. 위의 표기 방식의 경우에는 country에 대응되는 정보가 captial 근방에 표기된다.

    Note : Chen Notation

  1. Participation Constraint / Dependency Constraint
    • Zero / optional : 원형으로 표시
    • One or more/mandatory/total-participation: 수직선으로 표시
    💡
    즉 해당 relationship이 반드시 존재해야하는지 여부에 따라서 분류한 것이다.

    Note : Chen Notation

    💡
    기존의 notation과 다른 점은 participation 관련해서는 해당 entity와 가까운 쪽에 표기한다는 점이다.

Recursive Relationship

  • A relationship between the same entity

    → Supervisor role vs supervisee role

💡
즉, entity 내부의 원소들끼리 가지는 relationship

Database design : full picture

If we have an entity-relationship diagram, it can release ambiguity.

💡
Natural language basically have an ambiguity. 따라서 이 과정에서 여러 올바른 Entity relationship diagram이 발생할 수 있다.

Relational model: database-specific model

Chen Notation
Continuing our trip through different ERD notations, let's review the Chen ERD notation. Peter Chen, who developed entity-relationship modeling and published his work in 1976, was one of the pioneers of using the entity relationship concepts in software and information system modeling and design. The Chen ERD notation is still used and is considered to present a more detailed way of representing entities and relationships.
https://vertabelo.com/blog/chen-erd-notation/

Why a conceptual model (e.g. ER)?

  • More formal than natural language

    → Avoid misconceptions/multiple interpretations

  • Implementation independent
  • High-level description

    → Easier for people without a technical background

  • Comes with model transformations to be mapped to an implementation data model

반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.