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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -