19
Kendall & Kendall 2 Kendall & Kendall Systems Analysis and Design, 9e Entity Relationship Diagrams ERDs

Kendall & Kendall Systems Analysis and Design, 9e

  • Upload
    others

  • View
    38

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall

2Kendall & Kendall

Systems Analysis and Design, 9e

Entity Relationship Diagrams ERDs

Page 2: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-2

Entity-Relationship Model• Focus is on the Entities and their

relationships within the organizational system

• Another way to show the scope of a system

• Another way to understand the data of the system

• Will help in database creation

• Will affect programming

Page 3: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-3

Entity-Relationship Model• Entities and their relationships are

important because they have a direct connection with:

• Relational Databases

• See the common word “relation”

• Entity-Relationship Diagram

• Relational Database

Page 4: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-4

Entity-Relationship Model• Relational Databases

• A relational database usually contains many tables

• These tables connect to each other according to their relationship

• Essentially, each entity will quite probablybe a table in a relational database

• Relationships show how the entities are connected

Page 5: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-5

Relationships• For each relationship, you determine which

is the PRIMARY entity

• You will draw the primary entity on the top or on the left

treats

Is treated by Is/are part ofcontains

Page 6: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-6

Relationships• Relationship lines are labeled

• read clockwise

• Use complementary verbs that describe the same relation

treats

Is treated by

contains

Do not draw these arrows in an exercise

Page 7: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-7

Relationships

• Three types of relationships:

• One-to-one

• One-to-many

• Many-to-many

• This is called CARDINALITY

Page 8: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall Kendall & Kendall

Relationship Notation

• Cardinality is drawn using

Crow’s Foot Notation

• One:

• If it is only one, draw two short lines

• If the one is combined with another cardinality, just use one line

• Many is indicated by a crow’s foot

• “pata de gallina”

Page 9: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall Kendall & Kendall

Crow’s Foot Notation

Page 10: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall Kendall & Kendall

2-10

Figure 2.8Examples of different types of relationships in E-R diagrams

Page 11: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall Kendall & Kendall

Copyright © 2009 by Prentice Hall, Inc.2-11

One to One

Employee

Phone Extension

IsAssignedTo

IsListedFor

Primary Entity

Page 12: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall Kendall & Kendall

Copyright © 2009 by Prentice Hall, Inc.2-12

Many to One / One to Many

Employee

Department

BelongsTo

Is composed

of

Order

Product

ContainsIs composed

of

Page 13: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall Kendall & Kendall

One to Zero, One or Many

Supplier

Item

Supplies

Are Supplied

By

Page 14: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall Kendall & Kendall

Copyright © 2009 by Prentice Hall, Inc.2-14

Many to Many

Flight

Passengers

HaveTravel on

Page 15: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-15

Entity-Relationship Example

An entity-

relationship

diagram

showing a

many-to-one

relationship

Page 16: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-16

Examples of Different Types of Relationships in E-R Diagrams (Figure 2.8)

Page 17: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-17

Attributes

• Data attributes may be added to the diagram.

Patron

Patron NamePatron addressPatron phonePatron credit card

Primary Key - will be your first field, it will be underlined- field that can uniquely identify a record

Is Patron Namea good Primary key?

Page 18: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-18

Attributes

Page 19: Kendall & Kendall Systems Analysis and Design, 9e

Kendall & Kendall Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 2-19

Creating Entity-Relationship Diagrams

• List the entities in the organization

• Choose key entities to narrow the scope of the problem

• Identify what the primary entity should be

• Confirm the results of the above through data gathering