The bank where you work has decided to increase the loyalty of their users and give 50 dollars to those accounts with more than 5,000 dollars and have a high score of the loyalty to the company (more or equal 7). Of course, you are very careful and want to double-check everything. So you have to use a transaction.
The bank_account table has columns named account_id (INT), account_balance (DECIMAL) and customer_loyalty(INT). Customer loyalty score is in the range of 0-10, with 10 being the highest loyalty score.
| account_id | account_balance | customer_loyalty |
|---|---|---|
| 56891 | 600 | 9 |
| 56983 | 1000 | 3 |
| 14573 | 9200 | 10 |
| 98457 | 20200 | 10 |
| 48536 | 500 | 2 |
| 54367 | 41000 | 5 |
| 32459 | 800 | 7 |