How to setup database to make transactions (transfers) between two bank accounts

Joined
Dec 26, 2015
Messages
1
Reaction score
0
I want to setup a database that tracks transactions made from/to money accounts.

Typically money accounts would be bank accounts, but they can be cash accounts as well. Basically the type of the account really doesn't matter in this problem.

The transactions can be deposit, withdrawal and transfer between two accounts. I want to knw how to setup such a database.

I have in mind of registering each transaction in the money accounts.
The money accounts will have the same fields but the user shall be able to add/delete accounts.

I can describe the forms that I would like to use to make the transactions but I am not sure how to implement the transactions behind the forms in terms of tables...

Deposits: are made from a form with two main fields linked to drop-down lists: an Account field designating which money account (table?) to register the transaction (deposit) to (linked to drop-down list that lists the available money accounts) and a From field that designates some entity which makes the deposit and which is linked to some table of such entities (dropdown list).

Withdrawals: will be made from similar form with: Account and To fields, linked in the same way as above to money accounts and entities making withdrawals (instead of deposits here...).

Transfers: now hear the two fields From and To should be linked to money accounts instead of the entities and should be registering the transaction in such a way as to be able to view it as a deposit when viewing the transactions of the money account to which the transfer is being made and as a withdrawal in the other money account.

Two ideas that I have are the following:

1)
The db has:
- one table tracking all money account details: name, number, etc, that is identity information
- one table tracking the entities making deposits/withdrawls with identity information
- one table tracking all transactions linked to the money accounts and entities tables
In this scenario one transfer is one record in the third table above linking the above tables, an entity and a money account from the associated tables in the deposit/witdrawal transactions, two money accounts from the money accounts table in the transfer transaction ...

2)
The db has:
- the same first two accounts as above
- one table for each of the money account holding the transactions that are linked to each of them.
In this scenario one transfer is two records, one deposit in one money account and one withdrawl in another money account.

Is there a typical scheme for such a problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top