Study for the SQL Basics Test. Explore multiple-choice questions with comprehensive explanations and hints. Gear up for your SQL exam!

Multiple Choice

Which sequence begins a transaction and then commits it?

In SQL, a transaction must be opened before you can commit it. You start a transaction with a command like START TRANSACTION (or BEGIN TRANSACTION), perform your operations, and then use COMMIT to make all those changes permanent (or use ROLLBACK to discard them). The sequence START TRANSACTION; COMMIT; fits the pattern exactly: it opens the transaction first, then finalizes the changes with a commit. The other options start with rollback or mix up the order, which doesn’t end with a committed, permanent set of changes. In many databases you could also see BEGIN TRANSACTION as the opening command, but the essential idea remains the same: open, then commit.

In SQL, a transaction must be opened before you can commit it. You start a transaction with a command like START TRANSACTION (or BEGIN TRANSACTION), perform your operations, and then use COMMIT to make all those changes permanent (or use ROLLBACK to discard them). The sequence START TRANSACTION; COMMIT; fits the pattern exactly: it opens the transaction first, then finalizes the changes with a commit. The other options start with rollback or mix up the order, which doesn’t end with a committed, permanent set of changes. In many databases you could also see BEGIN TRANSACTION as the opening command, but the essential idea remains the same: open, then commit.