mysqlsqlsqltransaction

Sql transaction what can come after


Can you please tell me why c and d are the right answers here ? Thank you

Select the statements that can be used to complete the following SQL code block

BEGIN TRANSACTION
SELECT COUNT(*) FROM Enrollments WHERE Accepted = 1
UPDATE Enrollments SET Accepted = 1 WHERE CourseTitle = ’Data Base’

(a) END TRANSACTION (b) END (c) COMMIT (d) ROLLBACK TRANSACTION


Solution

  • Because those are the SQL key words that can be used to end a transaction

    COMMIT will submit your transaction and end it.

    While ROLLBACK will, as its name suggests roll the database back to how it was before the transaction was started.