title: Why use SELECT FOR UPDATE?
body: <p>I have question regarding what purpose we are using <code>SELECT FOR UDPATE</code>? What does it do exactly?</p>
  
  <p>I have 2 tables, from that I need to select rows from table and update the same rows.</p>
  
  <p>For example:</p>
  
  <p><strong>Select Query</strong></p>
  
  <pre><code>SELECT * from  t1 WHERE city_id=2 for update
  </code></pre>
  
  <p><strong>Update Query</strong></p>
  
  <pre><code>UPDATE t1 SET final_balance = final_balance - 100 WHERE city_id ='2'
  </code></pre>
  
  <p><strong>My question</strong> - Does this really lock the read operation till my update is done, or what does it exactly deal with?</p>
  
  <p><strong>My idea is nobody can read/update from/to this rows until my update finished..</strong></p>
  
  <p>Thanks!</p>