ERD Diagram

erDiagram User { int id PK string email string name datetime created_at } Order { int id PK int user_id FK decimal total string status datetime created_at } OrderItem { int id PK int order_id FK int product_id FK int quantity decimal price } Product { int id PK string name decimal price int stock } User ||--o{ Order : "places" Order ||--|{ OrderItem : "contains" Product ||--o{ OrderItem : "included in"

Entity List

Entity Attributes Primary Key Foreign Keys Notes
{Entity 1} {id, name, ...} id β€” {notes}
{Entity 2} {id, entity1_id, ...} id entity1_id β†’ Entity1 {notes}

Relationship Summary

Entity A Relationship Entity B Label Notes
{Entity A} one-to-many {Entity B} {label} {notes}
{Entity B} many-to-one {Entity C} {label} {notes}