Sei sulla pagina 1di 12

Database Design

3-4
Matrix Diagrams

Copyright © 2017, Oracle and/or its affiliates. All rights reserved.


Objectives

This lesson covers the following objectives:


• Identify relationships using a matrix diagram
• Draw an ERD from a matrix diagram

DDS3L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 3
Matrix Diagrams
Purpose
TEACHER COURSE TEACHER COURSE STUDENT

• It is useful to CLASS CLASS EXAM SEMESTER


know more than
one way to CAFETERIA GRADE CLUB
discover
relationships. CLASSROOM SCHOOL SCHOOL
EQUIPMENT

…etc. MAINTENANCE
STAFF

It may be simple enough But what about finding


to identify relationships relationships when you
given three entities. have thirteen or more
entities?

DDS3L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 4
Matrix Diagrams
Purpose
TEACHER COURSE TEACHER COURSE STUDENT

• Using a matrix CLASS CLASS EXAM SEMESTER


diagram,
especially when CAFETERIA GRADE CLUB
you are dealing
with many CLASSROOM SCHOOL SCHOOL
entities, is a EQUIPMENT

good way to …etc. MAINTENANCE


make sure that STAFF

you haven’t
missed any It may be simple enough
to identify relationships
But what about finding
relationships when you
relationships. given three entities. have thirteen or more
entities?

DDS3L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 5
Matrix Diagrams
Business Scenario
TRAVELER COUNTRY
• "I work for a travel agency.
I keep a record of the LANDMARK
countries that our
customers have visited
and the landmarks they’ve TRAVELER COUNTRY LANDMARK

seen in each country. It


helps us customize tours TRAVELER

for them."
COUNTRY
• We can use the matrix
diagram to uncover LANDMARK
relationships.
MATRIX DIAGRAM

DDS3L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 6
Matrix Diagrams
Matrix Diagrams

• To avoid confusion, be consistent in writing to and reading


from the matrix only in one direction.
TRAVELER COUNTRY LANDMARK

TRAVELER visit have seen


COUNTRY visited by the location of

LANDMARK seen by located in

correct: COUNTRY visited by TRAVELER


correct: LANDMARK seen by TRAVELER

incorrect: TRAVELER visited by COUNTRY


incorrect: TRAVELER seen by LANDMARK

DDS3L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 7
Matrix Diagrams
Matrix Diagrams

• Relationships
TRAVELER COUNTRY LANDMARK

discovered via the TRAVELER visit have seen

matrix diagram are COUNTRY visited by the location of

then drawn on the LANDMARK seen by located in


ERD.
• Matrix diagrams do TRAVELER visit COUNTRY

not show optionality visited by

and cardinality. have seen


the location of

located in

LANDMARK
seen by

DDS3L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 8
Matrix Diagrams
Matrix Diagrams

• Each COUNTRY may


TRAVELER COUNTRY LANDMARK

be visited by one or TRAVELER visit have seen

more TRAVELERs. COUNTRY visited by the location of

• Each TRAVELER may LANDMARK seen by located in

visit one or more


COUNTRY. TRAVELER visit COUNTRY
visited by

the location of
have seen

located in

LANDMARK
seen by

DDS3L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 9
Matrix Diagrams
Terminology

Key terms used in this lesson included:


• Matrix diagram

DDS3L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 10
Matrix Diagrams
Summary

In this lesson, you should have learned how to:


• Identify relationships using a matrix diagram
• Draw an ERD from a matrix diagram

DDS3L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 11
Matrix Diagrams

Potrebbero piacerti anche