A simple example of a CRUD implementation for a database layer.
The model is loan system with accounts, customers, loans, and links between the accounts and customers ("account-customer bridges") since accounts can have multiple customers and customers can have multiple accounts.
---
title: Loan System
---
erDiagram
accounts {
int account_id
timestamp created_ts
timestamp updated_ts
bool deleted
}
customers {
int customer_id
varchar forename
varchar surname
date date_of_birth
varchar postcode
timestamp created_ts
timestamp updated_ts
bool deleted
}
account_customer_bridge {
int account_id
int customer_id
timestamp created_ts
timestamp updated_ts
bool deleted
}
loans {
int loan_id
int account_id
decimal amount
decimal interest_rate
date start_date
date end_date
decimal current_balance
timestamp created_ts
timestamp updated_ts
bool deleted
}
customers ||--|{ account_customer_bridge : ""
accounts ||--|{ account_customer_bridge : ""
accounts ||--o{ loans : "opens"