mysql - Wanted [ Example of SQL transactions ] -


i new sql. trying understand transactions , getting pretty lost. if show me few examples of sql transactions.

what think have right transactions implemented dbm software pretty builds them based on in user interface.

so, example if want delete multiple rows how transaction like? this:

  1. savepoint sp1;
  2. delete customers fname = “james” , lname = “belik
  3. commit;
  4. savepoint sp2;
  5. delete customers fname = “james” , lname = “belik;
  6. commit;

or if not how be? , set transaction go?

any appreciated, thank you.

you've tagged question sql (generic), mysql, , access, , each "flavour" of sql may have own specific syntax (check relevant documentation, e.g., mysql here). however, generic example be

start transaction; update bankaccount set balance=balance-5 owner='james'; update bankaccount set balance=balance+5 owner='gord'; commit; 

if second update statement fails entire transaction "rolled back" , both account balances remain unchanged. if both updates succeed $5 transferred account mine.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -