Which combination correctly starts a transaction and then commits it?

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

Which combination correctly starts a transaction and then commits it?

Explanation:
A transaction must be started before any changes are made, and then finished with a commit to make those changes permanent. The correct pattern uses a start command to begin the transaction, followed by a commit. Starting with a rollback would undo any changes rather than begin a new transaction, so it isn’t the right way to initiate. Some databases accept a shortened form like START TRAN, but the clear, portable form is START TRANSACTION followed by COMMIT. This sequence ensures all included statements are treated as a single unit that either fully applies when committed or has no effect if rolled back.

A transaction must be started before any changes are made, and then finished with a commit to make those changes permanent. The correct pattern uses a start command to begin the transaction, followed by a commit. Starting with a rollback would undo any changes rather than begin a new transaction, so it isn’t the right way to initiate. Some databases accept a shortened form like START TRAN, but the clear, portable form is START TRANSACTION followed by COMMIT. This sequence ensures all included statements are treated as a single unit that either fully applies when committed or has no effect if rolled back.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy