Entity Relationship Diagram Template & Tutorial

Entity relationship diagrams show attributes and relationships for data objects (“entities”) in a system. These kinds of diagrams are useful for documenting existing systems or to conceptualize new ones.

customer

customer_id (PK) INT

first_name VARCHAR

last_name VARCHAR

email VARCHAR

phone VARCHAR

created_at TIMESTAMP

order

order_id (PK) INT

customer_id (FK) INT

address_id (FK) INT

order_date TIMESTAMP

status ENUM

total_amount DECIMAL

product

product_id (PK) INT

category_id (FK) INT

name VARCHAR

description TEXT

price DECIMAL

stock_qty INT

ordered by

has

contains

belongs to

ships to

included in

category

category_id (PK) INT

name VARCHAR

description TEXT

address

address_id (PK) INT

customer_id (FK) INT

street VARCHAR

city VARCHAR

country VARCHAR

postal_code VARCHAR

order_item

order_item_id (PK) INT

order_id (FK) INT

product_id (FK) INT

quantity INT

unit_price DECIMAL

Useful reminders

… to many

… to exactly 1

… to 0 or many

… to 1 or many