Need help trying to figure out accounting database schema
Date: Sun, 15 Jun 2008 20:01:23 -0700 (PDT)
Message-ID: <16f406ca-8779-4c33-9c27-7abd343bd4cc@m45g2000hsb.googlegroups.com>
For an accounting / banking database, I have the following in a two
transaction tables showing what someone spends or credits:
Transaction Table //one only
--
TransactionID
UserID
TransactionItemID Table //many
--
TransactionItemID
TransactionID
ItemID
AccountTable //one to one from TransactionID Table
--
AccountID
TransactionItemID
UserID
Debit
Credit
Balance
One transcation, many items tied to that single transaction. Results of that transaction put in the account table. Is this right or too many tables?
In my logic I can change the balance and a purchase or debit was incurred. I would have to have a starting balance to begin with (but what if it is the first transaction? I'd have not item and a blank transactionitemid.) It would simply be a credit when the user first starts using the database for that account and as they went along simple addition and subtraction for each item tied to a single transactionid.
Should the transaction table have the debit, credit, and balance table in it? Am I thinking about schema wrong? I couldn't find any example accounting or banking database schemas online to learn from for this (the ones I found didn't have what I wanted.)
Thank you for any insight. Received on Sun Jun 15 2008 - 22:01:23 CDT