Diagram Desk

Food delivery app ERD

Customer, store, menu, order and rider. An order points to all three; the rider can be empty until assigned, hence zero or one.

The diagram

CustomerPK customer_id intaddress varcharStorePK store_id intstore_name varcharMenuItemPK menu_id intFK store_id intitem_name varcharprice intOrdersPK order_id intFK customer_id intFK store_id intFK rider_id intRiderPK rider_id intvehicle varcharsellsplacesreceivesdelivers
ER diagram · 19 shapes

Reading it step by step

  • 'Customer' has 2 attributes, primary key customer_id.
  • 'Store' has 2 attributes, primary key store_id.
  • 'MenuItem' has 4 attributes, primary key menu_id, foreign key store_id.
  • 'Orders' has 4 attributes, primary key order_id, foreign key customer_id, store_id, rider_id.
  • 'Rider' has 2 attributes, primary key rider_id.
  • Each 'Store' relates to one or more 'MenuItem'; each 'MenuItem' to exactly one 'Store' (sells).
  • Each 'Customer' relates to zero or more 'Orders'; each 'Orders' to exactly one 'Customer' (places).
  • Each 'Store' relates to zero or more 'Orders'; each 'Orders' to exactly one 'Store' (receives).
  • Each 'Rider' relates to zero or more 'Orders'; each 'Orders' to zero or one 'Rider' (delivers).

Shape by shape

ShapeSymbolConnections
CustomerEntityholds customer_id, address · → Orders(places)
StoreEntityholds store_id, store_name · → MenuItem(sells), Orders(receives)
MenuItemEntityholds menu_id, store_id, item_name, price · ← Store
OrdersEntityholds order_id, customer_id, store_id, rider_id · ← Customer, Store, Rider
RiderEntityholds rider_id, vehicle · → Orders(delivers)

Symbols used here

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.

All er diagram symbols and how to draw

Diagram text

Paste this text into the editor to get the same picture, then change the names to fit your own work.

# Food delivery app ERD
erDiagram
  Customer {
    int customer_id PK
    varchar address
  }
  Store {
    int store_id PK
    varchar store_name
  }
  MenuItem {
    int menu_id PK
    int store_id FK
    varchar item_name
    int price
  }
  Orders {
    int order_id PK
    int customer_id FK
    int store_id FK
    int rider_id FK
  }
  Rider {
    int rider_id PK
    varchar vehicle
  }
  Store ||--|{ MenuItem : sells
  Customer ||--o{ Orders : places
  Store ||--o{ Orders : receives
  Rider |o--o{ Orders : delivers

More er diagram examples

All SeewolLabs tools