What does the COMMIT command do in SQL?

What does the COMMIT command do in SQL?

a) It saves the changes made in a transaction to the database
b) It rolls back all changes made in a transaction
c) It deletes the current table
d) It locks the database to prevent further changes

Answer:

a) It saves the changes made in a transaction to the database

Explanation:

The COMMIT command in SQL is used to save the changes made in a transaction to the database. Once a transaction is committed, its changes are permanent and cannot be rolled back.

COMMIT ensures that all operations within a transaction are applied to the database, guaranteeing data consistency. Without COMMIT, the changes made during the transaction remain temporary and can be undone using the ROLLBACK command.

COMMIT is used in scenarios where multiple SQL statements need to be executed together as a single unit, such as transferring funds between accounts or updating inventory levels after an order.

Reference:

Database Management System MCQ (Multiple Choice Questions)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top