ACID
ACID stands for Atomicity (all or nothing), Consistency (rules always enforced), Isolation (transactions do not interfere), and Durability (committed data survives crashes).
ACID stands for Atomicity (all or nothing), Consistency (rules always enforced), Isolation (transactions do not interfere), and Durability (committed data survives crashes).
-- Atomicity: both updates happen or neither does
-- Consistency: foreign keys and CHECK constraints still apply
-- Isolation: other sessions see the old balance until COMMIT
-- Durability: after COMMIT, the change survives a server restart
START TRANSACTION;
INSERT INTO orders (user_id, total) VALUES (1, 99.99);
INSERT INTO order_items (order_id, product_id, qty) VALUES (LAST_INSERT_ID(), 5, 2);
COMMIT;
InnoDB (MySQL default engine) provides full ACID compliance; MyISAM does not support transactions.