The consistency property in ACID, is to ensure that the transactions in queries are always in sense and all the constraints are satistfied before executing them and this in terms of wallet system can be a problem if a user tries to debit more than what is in their balance or update data in negative number and those can be stopped by being consistent
Examples of such situations and how an error is prompted to maintain consistency of the data
the balance is updated to negative value
UPDATE accounts
SET balance = -100
WHERE name = 'Alice';
an error is prompted
trying to debit more than the users balance
UPDATE accounts
SET balance = balance - 2000
WHERE name = 'Bob';
an error is prompted as cuz Bob only has balance of 500 in his account
Changes can be COMMIT only when the data is completely logically correct
Top comments (0)