영어와 데이터베이스 Ch.5

송종빈·2023년 6월 13일
0

23-1

목록 보기
24/31

Entity-Relationship Model

Design Process

Design Process

소프트웨어 개발 과정

  • 요구사항 분석 → Design(설계) → 구현/개발 → 평가/검증 → 유지보수

데이터베이스의 설계란?

  • 사용자 요구사항을 구체화
  • 요구사항을 개념스키마로 변환
  • 개념설계 (conceptual design)의 과정

데이터베이스 설계의 종류

  • Physical Design
    • 데이터베이스의 물리적 저장 구조를 정의
  • Logical Design
    • 데이터베이스의 논리적 구조 (데이터와 데이터 간의 관계)를 정의 → 효율적인 모델: Entity-Relationship (ER) Model

Entity-Relationship Model

Entity and Relationship

데이터베이스의 구성 요소

  • 개체들의 집합
  • 개체 사이의 관계

개체 (entity)

개체란 다른 대상과 구분되는 대상 (→ object)
개체는 고유한 '속성'을 지니며, 이를 'attribute'라고 함

관계 (relationship)

relationship이란 개체들 사이의 관계를 뜻함
ex) Hayes는 A-102의 depositor (Entity: Hayes, A-102 / Relationship: depositor)

relationship도 attribute를 가질 수 있음
ex) customer & account 어트리뷰트간의 관계(depositor)는 'access-date'라는 attribute를 가질 수 있음

Degree of a Relationship

  • 어떤 relationship에 참여하는 개체수
  • 어떤 relationship에 두 개체가 참여할때, degree: 2 (이러한 relationship을 binary relationship이라 함)
  • 일반적으로, 대부분의 relationship은 binary임
  • 한 relationship에 세 개 이상의 개체가 포함될 수 있지만, 매우 드뭄

Attribute

Attributes

  • 객체들이 공통적으로 갖는 속성들

Domain: 각 attribute가 가질 수 있는 값들의 집합
Attribute의 형태

  • simple(단순) vs composite(복합) attributes
  • single-valued(단일 값) vs multi-valued(복수개의 값) attributes
  • derived(유도) attributes

Simple vs Composite attributes

  • composite attribute: 여러 Attribute들이 모여서 나타나는 복합 Attribute

ex)

Single-valued vs Multi-valued attributes

  • single-valued = atomic value
    ex) last name (single; 성은 한 사람당 하나만 있을때)
    ex) phone number (multi-value; 전화번호가 여러 개 있을때)

Derived attributes

  • 다른 attribute로부터 값을 유추할 수 있는 attribute
    ex) age ← date_of_birth (age = derived attributes)

Mapping Cardinality (관계수)

  • Relationship에 참여하는 두 개체가 있을 때 한 개체와 관련성이 있는 상대 개체의 수
  • binary relationhip의 특성을 표현하는데 중요한 정보로 사용됨
    ONE to ONE (1:1)
    ONE to MANY (1:n)
    MANY to ONE (n:1)
    MANY to MANY (n:n)

Key

Key (remind)

Super key: 각 entity가 고유한 값을 가져 서로 구분되는 하나 이상의 attribute
Candidate key: 가능한 super key 중 가장 적은 수의 attribute를 가진 key들
primary key: 가능한 candidate key 중 선택된 key

Keys for Relationship

어떤 relationship에 참여하는 두 개체가 있을 때, 각 개체의 기본 키의 조합은 그 relationship의 super key가 됨 (유일성)

E-R Diagram

E-R Diagram with Composite, Multivalued, & Derived Attributes

Participation of Entity

Participation of an Entity in a Relationship

전체 참여 (total participation)

  • double line으로 표시함, 모든 개체들이 relationship에 참여하는 경우
    ex) loan → borrower (total): 모든 대출계좌(loan)는 소유자(customer)가 있어야함

부분 참여 (partial participation)

  • single line으로 표시함, 해당 relationship에 참여하지 않는 개체가 있을 수 있는 경우
    ex) customer → borrower (partial): 몇몇 고객(customer)은 대출계좌(loan)가 없을 수도 있음

Cardinality Limits

  • HUFS Student → Advisor (1..1): 학생 한 명당 교수는 1명 이상 1명 이하 (1명)
  • HUFS Professor → Advisor (0..*): 교수 한 명당 학생은 0명 이상 (0~N명)
profile
Student Dev - Language Tech & Machine Learning

0개의 댓글