Skip to content Skip to main navigation Skip to footer

Matrix Diagrams

Matrix diagrams are an effective way for checking complex many-to-many database relationships. Everything about Matrix Diagrams explained here.


This article covers the following objectives:


  • It is useful to know more than one way to discover relationships.
  • Using a matrix diagram, especially when you are dealing with many entities, is a good way to make sure that you haven’t missed any relationships.
Matrix Diagrams

Business Scenario

  • “I work for a travel agency. I keep a record of the countries that our customers have visited and the landmarks they’ve seen in each country. It helps us customize tours for them.”
  • We can use the matrix diagram to uncover relationships.
Matrix Diagram

Sometimes when you are working with many entities, it’s hard to know where to start defining relationships. What if you miss something? How do you make sure that you haven’t missed some combination of entities? Maybe you’ve missed a relationship!

We are going to learn another useful way to identify relationships.

Matrix Diagrams

  • To avoid confusion, be consistent in writing to and reading from the matrix only in one direction.
Matrix Diagrams
  • Relationships discovered via the matrix diagram are then drawn on the ERD.
  • Matrix diagrams do not show optionality and cardinality.
Matrix Diagrams

Note: that if an entity is related to itself, a cell on the diagonal will also contain a relationship.

  • Each COUNTRY may be visited by one or more TRAVELERs.
  • Each TRAVELER may visit one or more COUNTRY.

After completing the matrix diagram, you should draw the relationships on the ERD to specify optionality and cardinality by first writing the relationships in ERDish, then draw the ERD. The completed ERD should match the relationships uncovered in the Matrix Diagram.

  • Each TRAVELER may have seen one or more LANDMARKs.
  • Each LANDMARK may be seen by one or more TRAVELERs.
  • Each LANDMARK must be located in one and only one COUNTRY.
  • Each COUNTRY may be the location of one or more LANDMARKs.

Note that there are M:M (Many to Many) relationships between TRAVELER and COUNTRY, and between TRAVELER and LANDMARK. These are valid relationships, but they will be discussed in more detail later.


Key terms used in this tutorial included:

  • Matrix diagram


In this tutorial, you should have learned how to:

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

Was This Article Helpful?

Related Articles

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *