Accounting and Database design, storing debit and credit amount

后端 未结 7 1665
执笔经年
执笔经年 2021-02-06 00:57

QUESTION: In the case below should I have stored all my amount as positives decimal amounts then flag the amount as either being a \"Debit\" or \"Credit\" rather than storing d

7条回答
  •  生来不讨喜
    2021-02-06 01:19

    Here is a transaction detail schema from a great book called "The Data Model Resource Book". This schema meets all the recording requirements without using two columns.

    PK TransactionID - int
    PK TransactionDetailSequenceID - smallint
       Amount decimal
       CreditDebitFlag char(1)
    

    Simple and effective, and it doesn't use extraneous columns as other answers here suggest. One column to store all the numeric value data and still gives you the ability to track asset and liability accounts properly.

提交回复
热议问题