$ ./guess_the_languageSQL & Databases
SQL & Databases · medium · #27

Which values are in t afterwards?

BEGIN;
INSERT INTO t VALUES (1);
SAVEPOINT s;
INSERT INTO t VALUES (2);
ROLLBACK TO s;
INSERT INTO t VALUES (3);
COMMIT;
  1. Only 3
  2. 1, 2 and 3
  3. 1 and 3
  4. Only 1
ROLLBACK TO s undoes only the work after the savepoint; the transaction continues and commits 1 and 3.
Play SQL & Databases ▸