/* Code Comments */

Entity Relationship Diagrams - What The Lines Mean

June 29, 2019

Yesterday, in talking about Postgres and Subqueries I was trying to represent a relationship between tables. I knew intuitively what I was trying to communicate, but wasn’t sure about the syntax.

Digging into I found Lucidchart1 had put together a pretty useful cheatsheet on entity-relationship diagrams which the information I was looking for (images credit to Lucidchart).

erd line def

Interestingly, I think one of the examples they have in the post doesn’t make a lot of sense given that information.

erd sample relationship In this example, the BankId is the primary key (which means it’s not nullable). As a result, the way I’m reading the above ERD is that we can have zero or one BankId associated with zero too many cars’ FinancedBy.

How you can have zero is beyond me, however, at least I now know why it’s confusing because what the lines mean is no longer a mystery!

Footnotes


Stephen Weiss

Thanks for reading! My name's Stephen Weiss. I live in Chicago with my wife, Kate, and dog, Finn.
Click here to see the archives of my weeks in review and sign up yourself!