Historical Perspectives

kushal-kumar
ch02.ppt

Chapter 2
Data Modeling

BLCN-534: Fundamentals of Database Systems

Chapter Objectives

  • Explain the concept and practical use of data modeling.
  • Recognize which relationships in the business environment are unary, binary, and ternary relationships.
  • Describe one-to-one, one-to-many, and many-to-many unary, binary, and ternary relationships.
  • Recognize and describe intersection data.
  • Model data in business environments by drawing entity-relationship diagrams that involve unary, binary, and ternary relationships.

*-2

*

Data Modeling Basics

  • Exploring the different ways that entities can relate to each other as they always do in the real world
  • Devising a way of recording, of diagramming, the entities and the ways in which they interrelate in the business environment

2-*

Entity-Relationship (E-R) Model

  • A diagramming technique
  • Diagrams entities (with attributes) and the relationship between the entities.
  • There are many variations of E-R diagrams in use.

2-*

E-R Model Entity (and its attributes)

Rectangular shape

Salesperson = a type of entity

Name of entity is in caps above the separator line.

2-*

E-R Model Entity (and its attributes)

  • Entity type’s attributes are shown below the separator line.
  • PK and boldface denote the attribute(s) that constitute the entity type’s unique identifier.

2-*

Binary Relationships

  • Simplest kind of relationship
  • Relationship between two entity types
  • A salesperson “sells” products or products are “sold” by salespersons

2-*

Cardinality

  • Represents the maximum number of entities that can be involved in a particular relationship.
  • One-to-One Binary Relationship
  • One-to-Many Binary Relationship
  • Many-to-Many Binary Relationship

2-*

One-to-One Binary Relationship

  • 1-1
  • A single occurrence of one entity type can be associated with a single occurrence of the other entity type and vice versa.

2-*

One-to-Many Binary Relationship

  • 1-M
  • Use “crow’s foot” to represent the multiple association.
  • “many” = the maximum number of occurrences that can be involved, means a number that can be 1, 2, 3, ... n.

2-*

Many-to-Many Binary Relationship

  • M-M
  • “many” can be either an exact number or have a known maximum.

2-*

Cardinality

2-*

Modality

  • The minimum number of entity occurrences that can be involved in a relationship.
  • “inner” symbol on E-R diagram (“outer” symbol is cardinality)

2-*

Cardinality & Modality

2-*

Intersection Data

  • Describes the relationship between two entities.
  • Used with many-to-many relationships.
  • Represented on E-R diagram as an “associative entity”

2-*

Many-to-Many Binary Relationship with Intersection Data

  • For example, we know not only that salesperson 137 sold some of product 24013 but also how many units of that product that salesperson sold.

2-*

Associative Entity

  • Entities can have attributes; many-to-many relationships can have attributes.
  • Many-to-many relationship may be treated similarly to entities in an E-R diagram.

2-*

Associative Entity

  • The unique identifier of the associative entity is usually the combination of the unique identifiers of the two entities in the many-to-many relationship.

2-*

Unary Relationships

  • Associate occurrences of an entity type with other occurrences of the same entity type.
  • Cardinality:
  • One-to-One Unary Relationship
  • One-to-Many Unary Relationship
  • Many-to-Many Unary Relationship

2-*

Unary Relationships

2-*

Ternary Relationship

  • Involves three different entity types.

2-*

Example Use Cases

3-*

  • The General Hardware Company E-R Diagram
  • Customer Employee is a dependent entity.

2-*

Good Reading Bookstores

2-*

World Music Association

2-*

Lucky Rent-A-Car

2-*