START TRANSACTION;UPDATE stocks SET quantite = quantite -200 WHERE id_entrepot =1;UPDATE stocks SET quantite = quantite +200 WHERE id_entrepot =2;COMMIT;
Solution Exercice 2
START TRANSACTION;INSERT INTO clients (nom, email) VALUES ('Alice', '[email protected]');INSERT INTO commandes (id_client, montant_total) VALUES (LAST_INSERT_ID(), 300);ROLLBACK;