Chalkline / Guides / ER diagram symbols

ER diagram symbols, explained with examples

An entity relationship (ER) diagram shows the things a database stores and how they connect. Once you can read the symbols at the ends of the lines, you can read any database design. Here is every symbol in plain words.

Updated 7 November 2026 · 3 minute read

What an ER diagram shows

An ER diagram has three ingredients:

  • Entities: the things you store, such as Customer, Order or Product. Each becomes a table.
  • Attributes: the facts about each thing, such as a name or a price. Each becomes a column.
  • Relationships: how things connect, such as "a customer places orders". These become foreign keys.

Entity and attribute symbols

SymbolMeans
A box with a titleAn entity (a table)
A line inside the boxAn attribute (a column)
PKPrimary key: the column that identifies each row
FKForeign key: a column that points to another table
UKUnique: no two rows share this value

Crow's foot cardinality symbols

The ends of each relationship line say how many of one thing can link to the other. Read the symbol nearest the box you are reading toward.

Symbol at the line endMeans
Two short barsExactly one
A circle and a barZero or one
A crow's foot and a barOne or many
A crow's foot and a circleZero or many

In diagram text the same four ends are written as || (exactly one), |o (zero or one), }| (one or many) and }o (zero or many).

The circle means "optional" (zero is allowed). The bar means "at least one". The crow's foot means "many".

Example: a small shop

A shop: customers place orders, and orders contain productsA shop: customers place orders, and orders contain productsCUSTOMERid int PKname stringemail string UKORDERid int PKcustomer_id int FKplaced_on dateORDER_LINEorder_id int FKproduct_id int FKquantity intPRODUCTid int PKtitle stringprice decimalplacescontainsrefers to
A shop: customers place orders, and orders contain productsOpen this example in Chalkline →

How to read it:

  • A customer places zero or many orders, and each order belongs to exactly one customer.
  • Each order contains one or many order lines.
  • Each order line refers to exactly one product, and a product can appear in zero or many order lines. ORDER_LINE is the table that joins orders and products, which is how databases store a many to many relationship.

Example: a school

Students, courses and teachersStudents, courses and teachersTEACHERid int PKname stringCOURSEid int PKtitle stringSTUDENTid int PKname stringteachesenrols in
Students, courses and teachersOpen this example in Chalkline →

A teacher teaches zero or many courses. A student enrols in zero or many courses, and a course has zero or many students. When you build the real database, that many to many line becomes a joining table such as ENROLMENT.

How to design an ER diagram in five steps

  1. List the nouns in the problem: customers, orders, products. Those are your entities.
  2. Give each one a primary key and the attributes you need.
  3. Draw the relationships and name them with a verb: places, contains, teaches.
  4. Set the cardinality at both ends: ask "can there be none? can there be many?" in each direction.
  5. Replace many to many lines with a joining table that has a foreign key to each side.

Writing an ER diagram as text

erDiagram
  CUSTOMER ||--o{ ORDER : places
  ORDER {
    int id PK
    int customer_id FK
  }

||--o{ reads from left to right: exactly one CUSTOMER to zero or many ORDERs. Use -- for a solid line (the child depends on the parent) and .. for a dashed one.

Already have the database?Paste CREATE TABLE statements and get the ER diagram drawn for you
Open the example

Drawing ER diagrams for free

In Chalkline, open Diagram as text → Database, type the entities and relationships, and press Apply. Crow's foot ends and keys are drawn for you, in a hand drawn or a clean style. If you already have SQL, see SQL to ER diagram, which builds the diagram from your CREATE TABLE statements and turns your edits back into SQL. For object models rather than tables, see UML class diagrams.