Content

  1. Basics
  2. Keys
  3. E-R Diagram
    1. Attribute Types
    2. Weak Entity Set
    3. Role
    4. Specialization & Generalization
  4. Relational Tables

Basics

  • Entity
    • Attributes
  • Relationship
  • Constraints
    • Mapping cardinalities
      • One (->) v.s. > 1 (-)
    • Participation constraints
      • Total (=) v.s. Partial (-)

Keys

  • Super key
    • A set of >= 1 attributes whose values uniquely determine each entity
  • Candidate key
    • Minimal super key
    • Can be more than 1 candidate key
  • Primary key (underline)
    • 1 of the candidate keys are selected as primary key
    • Cannot be NULL
    • Cannot be duplicated
    • Static
  • Partial key (dashed underline)
    • Or discriminator
    • Distinguish among weak entities
  • Foreign key
    • Referential constraint between two tables
    • Matches a candidate key of another table

E-R Diagram

Attribute Types

  • Single attribute v.s. composite attribute
  • Single-valued attribute v.s. multi-valued attribute (double ellipse)
  • Derived attribute (dashed ellipse)

Weak Entity Set

Weak entity set (double rectangle) relates to an identifying entity set via total, many-to-one identifying relationship set (double diamond).

Primary key = primary key of identifying entity set + discriminator of weak entity set

Role

Entity sets of a relationship the same.

Specialization & Generalization

Subgroupings within an entity set.

Lower-level entity set inherites all attributes & relationship set participation of high-level entity set.

  • Total or partial
  • Disjoint or overlapping

Relational Tables

Relational Table
Entity sets Entity(__primary_key__, ...attributes)
Composite attributes Entity(__primary_key__, attribute1.sub_attribute1, attribute1.sub_attribute2, ...)
Multi-valued attributes Entity(__primary_key__, ...attributes)
MultiValuedAttr(__foreign_key_entity__, __attribute__)
Weak entity set Entity(__primary_key__, __foreign_key_identifying_entity__, ...attributes)
(Many-to-many) Relationship set Relationship(__foreign_key_entity1__, __foreign_key_entity2__, ...attributes)
_(Many-to-one \ \ one-to-many) Relationship set_ ManySideEntity(__primary_key__, ...attributes, foreign_key_one_side_entity)
(One-to-one) Relationship set AnySideEntity(__primary_key__, ...attributes, foreign_key_other_side_entity)
Specialization method 1 HigherLevelEntity(__primary_key__, ...attributes) (optional if total specialization)
LowerLevelEntity(__foreign/primary_key_higher_level_entity__, ...local_attributes)
Specialization method 2 HigherLevelEntity(__primary_key__, ...attributes) (optional if total specialization)
LowerLevelEntity(__foreign/primary_key_higher_level_entity__, ...local_attributes)

results matching ""

    No results matching ""