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:
- savepoint sp1;
- delete customers fname = “james” , lname = “belik
- commit;
- savepoint sp2;
- delete customers fname = “james” , lname = “belik;
- 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
Post a Comment