Data modification & MERGE
Exercise · SQL & Querying

Predict, then run it

Predict the output

ledger(item, n) = (cola,3). A delete-then-reload that fails mid-way should leave the ledger untouched — wrap it so ROLLBACK restores:

BEGIN; DELETE FROM ledger; ROLLBACK; SELECT COUNT(*) AS rows FROM ledger;

Predict the exact output.