Chapter 3 Data Modeling Fundamentals of Database Management Systems by Mark L. Gillenson, Ph.D....

Preview:

Citation preview

Chapter 3Chapter 3Data ModelingData Modeling

Fundamentals of Database Management Systemsby

Mark L. Gillenson, Ph.D.

University of Memphis

Presentation by: Amita Goyal Chin, Ph.D.

Virginia Commonwealth University

John Wiley & Sons, Inc.

3-3-22

Chapter ObjectivesChapter Objectives

Explain the concept and practical use of data Explain the concept and practical use of data modeling.modeling.

Recognize which relationships in the business Recognize which relationships in the business environment are unary, binary, and ternary environment are unary, binary, and ternary relationships.relationships.

Describe one-to-one, one-to-many, and many-Describe one-to-one, one-to-many, and many-to-many unary, binary, and ternary relationships.to-many unary, binary, and ternary relationships.

3-3-33

Chapter ObjectivesChapter Objectives

Recognize and describe intersection data.Recognize and describe intersection data.

Model data in business environments by Model data in business environments by drawing entity-relationship diagrams that drawing entity-relationship diagrams that involve unary, binary, and ternary involve unary, binary, and ternary relationships.relationships.

3-3-44

Essence of Data ModelingEssence of Data Modeling

Exploring the different ways that entities Exploring the different ways that entities can relate to each other as they always do can relate to each other as they always do in the real worldin the real world

Devising a way of recording, of Devising a way of recording, of diagramming, the entities and the ways in diagramming, the entities and the ways in which they interrelate in the business which they interrelate in the business environmentenvironment

3-3-55

Entity-Relationship (E-R) Entity-Relationship (E-R) ModelModel

A diagramming techniqueA diagramming technique

Diagrams entities (with attributes) and the Diagrams entities (with attributes) and the relationship between the entities.relationship between the entities.

There are many variations of E-R There are many variations of E-R diagrams in use.diagrams in use.

3-3-66

E-R Model Entity (and its E-R Model Entity (and its attributes)attributes)

Rectangular shapeRectangular shape

Salesperson = a type of entitySalesperson = a type of entity

Name of entity is in caps above the separator line.Name of entity is in caps above the separator line.

3-3-77

E-R Model Entity (and its E-R Model Entity (and its attributes)attributes)

Entity type’s attributes are shown below the separator Entity type’s attributes are shown below the separator line.line.

An asterisk denotes attribute(s) that constitute the entity An asterisk denotes attribute(s) that constitute the entity type’s type’s unique identifierunique identifier..

3-3-88

RelationshipsRelationships

Associations between entitiesAssociations between entities

Different kinds:Different kinds: Binary relationshipsBinary relationships Unary relationshipsUnary relationships Ternary relationshipsTernary relationships

3-3-99

Binary RelationshipsBinary Relationships

Simplest kind of relationshipSimplest kind of relationship Relationship between two entity typesRelationship between two entity types Diamond-shaped box represents relationshipDiamond-shaped box represents relationship A salesperson “sells” products or products are sold by A salesperson “sells” products or products are sold by

salespersonssalespersons

3-3-1010

CardinalityCardinality

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

3-3-1111

One-to-One Binary One-to-One Binary RelationshipRelationship

1-11-1

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

3-3-1212

One-to-Many Binary One-to-Many Binary RelationshipRelationship

1-M1-M

Use “crow’s foot” to represent the multiple Use “crow’s foot” to represent the multiple association.association.

““many” = the maximum number of many” = the maximum number of occurrences that can be involved, means occurrences that can be involved, means a number that can be 1, 2, 3, ... n.a number that can be 1, 2, 3, ... n.

3-3-1313

Many-to-Many Binary Many-to-Many Binary RelationshipRelationship

M-MM-M

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

3-3-1414

CardinalityCardinality

3-3-1515

ModalityModality

The minimum number of entity The minimum number of entity occurrences that can be involved in a occurrences that can be involved in a relationship.relationship.

““inner” symbol on E-R diagram (“outer” inner” symbol on E-R diagram (“outer” symbol is cardinality)symbol is cardinality)

3-3-1616

Cardinality & ModalityCardinality & Modality

3-3-1717

Intersection DataIntersection Data

Describes the relationship between two entities.Describes the relationship between two entities.

Used with many-to-many relationships.Used with many-to-many relationships.

Represented on E-R diagram in a special five-Represented on E-R diagram in a special five-sided intersection data box, which is attached to sided intersection data box, which is attached to the relationship diamond between the two entity the relationship diamond between the two entity boxes.boxes.

3-3-1818

Many-to-Many Binary Relationship Many-to-Many Binary Relationship with Intersection Datawith Intersection Data

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

3-3-1919

Associative EntityAssociative Entity

Entities can have attributes; many-to-many relationships Entities can have attributes; many-to-many relationships can have attributes.can have attributes.

Many-to-many relationship may be treated similarly to Many-to-many relationship may be treated similarly to entities in an E-R diagram.entities in an E-R diagram.

3-3-2020

Associative EntityAssociative Entity

Should you diagram as associative entity Should you diagram as associative entity or many-to-many relationship?or many-to-many relationship? personal tastepersonal taste follow company standardsfollow company standards

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

3-3-2121

Unary RelationshipsUnary Relationships

Associate occurrences of an entity type Associate occurrences of an entity type with other occurrences of the same entity with other occurrences of the same entity type.type.

Cardinality:Cardinality: One-to-One Unary RelationshipOne-to-One Unary Relationship One-to-Many Unary RelationshipOne-to-Many Unary Relationship Many-to-Many Unary RelationshipMany-to-Many Unary Relationship

3-3-2222

Unary Unary RelationshipsRelationships

3-3-2323

Ternary RelationshipTernary Relationship

Involves three different entity types.Involves three different entity types.

3-3-2424

Ternary Relationship: Ternary Relationship: The General Hardware The General Hardware Company E-R Company E-R DiagramDiagram

Customer Employee, a Customer Employee, a dependent entity, is dependent entity, is distinguished by a distinguished by a diagonal hash mark in diagonal hash mark in each corner of its each corner of its attribute area. attribute area.

3-3-2525

Good Reading BookstoresGood Reading Bookstores

3-3-2626

World Music AssociationWorld Music Association

3-3-2727

Lucky Rent-A-CarLucky Rent-A-Car

3-3-2828

“Copyright 2004 John Wiley & Sons, Inc. All rights reserved. Reproduction or translation of this work beyond that permitted in Section 117 of the 1976 United States Copyright Act without express permission of the copyright owner is unlawful. Request for further information should be addressed to the Permissions Department, John Wiley & Sons, Inc. The purchaser may make back-up copies for his/her own use only and not for distribution or resale. The Publisher assumes no responsibility for errors, omissions, or damages caused by the use of these programs or from the use of the information contained herein.”