Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save shivamka1/2aae835186d4eac9ea05118217717016 to your computer and use it in GitHub Desktop.

Select an option

Save shivamka1/2aae835186d4eac9ea05118217717016 to your computer and use it in GitHub Desktop.
BEGIN;
SELECT balance FROM accounts WHERE user_id = 1;
-- client logic checks balance > 0
UPDATE accounts SET balance = balance - 100 WHERE user_id = 1;
COMMIT;

Comments are disabled for this gist.