---
title: Bank example
---
erDiagram
User {
int user_id pk
datetime created_at
}
Customer{
int customer_id pk
int user_id fk
string phone_number
int customer_level_id fk
datetime created_at
}
Account{
int account_id pk
int account_number
int customer_id fk
datetime created_at
}
TransactionTable{
int transaction_id pk
}
Ledger{
int transaction_id fk
int account_number fk
decimal amount
datetime created_at
}
AccountType {
int account_type_id pk
string account_type_name
datetime created_at
}
CustomerLevel{
int customer_level_id pk
string customer_level_name
datetime created_at
}
User |o--o| Customer : can_be
Customer |o--o| CustomerLevel : has
Customer |o--o{ Account : has
Account |o--o| AccountType : can_be
Ledger |o--o{ Account : has
Ledger |o--o{ Account : has
Ledger |o--o{ TransactionTable : has_
Conecptua/logical model, first draft