Entity relationship diagram (ERD)

The ERD format is small and focused: entities in brackets, attributes underneath, relationships at the bottom with cardinality symbols on both sides.


#What this example shows

  • Asterisks marking primary keys and plus signs marking foreign keys.

  • Cardinality declared on both ends of every relationship.

  • A layout generated entirely from the declaration order.


#A worked example

Open it, edit it, or copy the source below.

Entity relationship diagram (ERD)

The source, which you can paste into a new diagram and edit:

[Person]
*id
name
email
height
+department_id

[Department]
*id
name
budget
+head_id

[Project]
*id
name
started_on
+lead_id

Person *--1 Department
Project *--1 Person
Department 1--1 Person

#Making it your own

  • Cardinality symbols are ?, 1, * and +, and they go on both sides.

  • Attributes are one per line, directly under the entity.

  • For types, defaults and indexes, use DBML instead.



Four symbols, and that is the language.