1

Hello i'm trying to model a simple banking scheme where I have 3 transactions: withdraw, transfer, deposit. of these 3 operations, the transfer is the only one that needs more attributes, I need to know the accounts participating in the transfer, and who received and who sent it.

At first I thought of something simple like that, but it seems very strange:

enter image description here

but this seems very vague to me, and when do I need the statement from the two accounts participating in the transfer?

could someone help me with this?

3
  • 1
    that is normal when interacting with the same entity, you will always as long as you are iterested in bith join the table twice
    – nbk
    Commented Mar 23, 2021 at 22:58
  • @nbk the best choice is origin_id and target_id ?
    – Ming
    Commented Mar 23, 2021 at 23:04
  • for the transaction table yes, you need both ids. but banking is mostly with other banks so your schema should have a iban, that is much more flexible and you can iteract internally and externally with the same table
    – nbk
    Commented Mar 23, 2021 at 23:08

1 Answer 1

1

The way I would initially think of this (as an accountant in a previous life) is not as a transfer, but as what is going on in MY bank's account? One stored procedure would deduct funds from one of my member's accounts, and a second stored procedure (initiated by the application) would send something to the other bank system to deposit funds. The record of the transfer would go into the individual account's records as just another transaction, like a deposit or withdrawal. There would be no lasting connection between the two accounts.

Even if the transfer was between a member's checking and savings accounts, they would still be treated as essentially two transactions going on at nearly the same time. One deposit, one withdrawal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.