I have a transaction table that logs credits and debits. The numbers are always int (-1 to usually 100). My issue is that Debits have a lot more data than credits, and it feels weird having this data in the same table.

ID |
ClientID |
CardCodeID |
ClientDeviceID |
ClientEmployeeID |
ProjectID |
PlantID |
MaterialID |
Amount |

A credit only uses ClientID, Amount,MaterialID and CreatedAt, and a Debit uses All the columns. Is there a more effecient way to design this table?

1 Answer 1


Given balances are a sum of amounts, you are storing one of debits or credits as negative right?, the same table is ok. Having a few NULLable fields is ok too even if slightly redundant.

  • 1
    Debits are negative, Credits are positive
    – SpaceTime
    Apr 1, 2020 at 5:25

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.