Diagram Desk

ER diagram (ERD) crow's foot notation, examples

Entities, attributes, primary and foreign keys and crow's foot cardinality in an ER diagram, with editable ERD examples such as a shop and a library.

What is a er diagram

An ER diagram is a database blueprint: the things to store (entities), their attributes, and how many of one relate to another (cardinality). It settles the structure before tables are created.

  • Database classes and exam questions
  • Agreeing on table structure for a new product
  • Turning an existing SQL schema into a picture
MemberPK member_id intemail varcharname varcharOrdersPK order_id intFK member_id intordered_at dateOrderItemPK item_id intFK order_id intFK product_id intquantity intProductPK product_id inttitle varcharprice intplacescontainsappears_in
Online shop ERD

Symbols and meanings

SymbolMeaning
EntityA thing to store: name on top, attributes below.
Primary key (PK)The attribute that identifies one row; underlined.
Foreign key (FK)An attribute pointing to another entity's key.
Exactly oneTwo short bars at the line end.
Zero or oneA bar and a circle.
Zero or manyA crow's foot and a circle.
One or manyA crow's foot and a bar.

Basis: Crow's Foot(IE) 표기, 정보처리기사 데이터베이스 설계 범위

How to draw one

  1. Pick the nouns to store as entities (Member, Order, Product).
  2. Give each entity a primary key (PK).
  3. Mark attributes that point to another entity as foreign keys (FK).
  4. Put cardinality marks on both ends of each relationship: one (bars), zero or one (circle and bar), many (crow's foot).
  5. Resolve many-to-many with an associative entity (OrderItem).

Paste SQL CREATE TABLE statements as they are, or write Mermaid erDiagram: Entity { type name PK } and Member ||--o{ Order : places.

Common mistakes

  • An entity without a primary key.
  • A foreign key with no relationship line.
  • Cardinality marks on the wrong end.
  • A many-to-many relationship left without an associative entity.

The editor's notation check flags these mistakes every time the picture changes.

16 er diagram examples

Draw a er diagram from scratch

All SeewolLabs tools