How to write SQL queries to populate the tables while synchronizing transactions and account balance?
Most financial systems of record are very complex. They involve separate concepts of "posting" transactions, then "settling" transactions afterwards, as well as "closing" of financial periods, after which settled transactions can't be modified. 

Say you walk into your bank and withdraw $100. The banker posts that transaction in front of you, but it isn't settled until later (often overnight). If the banker accidently typed in the wrong withdrawal amount, they can adjust the transaction and that corrected transaction will appear on your statement as a single -$100 withdrawal. If the error isn't noticed until after the transaction is settled, the correction is posted as a separate transaction and your statement will show the incorrect transaction + correction = net correct amount. Most banks close each day as part of settling standard bank accounts, making the two fairly similar. Credit cards generally close months (which is when they often compute fees, send statements, etc.)

One reason for the complexity is the concerns for concurrency and isolation on these methods. Consider the race condition on option 1: 


two users try to execute transactions on the same user at the same time. 
The two SELECT statements run in parallel to get balance (say, $500). 
Then they both insert transactions (again in parallel) of -100.
Both will calculate the new balance of $500-$100=400. They'll block each other on the update, but the race condition will make the balance incorrect because they selected the starting balance without knowledge of the prior transaction.


So... That's my way of saying this is actually extremely complex if you care about being correct. Assuming accuracy matters, you might consider an alternate approach. Real life will be a bit more complicated to implement than this, but this is a high level approach :
- post transactions as normal, but don't update the balance. 
- asynchronously, "close" a time period, at which time you process all transactions during that period to compute the new balance &amp; cache that on the user, along with the time it was computed.
 - when you need a balance, look up the cached balance, and all transactions since it was computed. Return that balance to the user.