Another question from a programmer who is trying for the first time to put together a database model.
My application has users, accounts, and transactions. At first I had all the tables in 3NF (or, as I suppose). Then I decided to add a balance box for users, mainly because my code would be open source and I don’t want people to mess up the business logic of the system by changing the PHP code. In this way, triggers and stored procedures update the balance.
Now there is a new requirement that users on their account page display a list of all transactions that they made with the balance column so that they can watch how their balance changes with each transaction. Of course, transactions and users are in different tables.
How to do it? My current solution sketch displays the balance_history table with foreign keys for transaction_id and user_id. Any other suggestion? Thanks.
source
share