Which two statements complete a transaction? (Choose two)

  1. DELETE employees;

  2. DESCRIBE employees;

  3. ROLLBACK TO SAVEPOINT C;

  4. GRANT SELECT ON employees TO SCOTT;

  5. ALTER TABLE employees SET UNUSED COLUMN sal;

  6. Select MAX(sal) FROM employees WHERE department_id = 20;


Correct Option: C,E

AI Explanation

To answer this question, we need to understand what a transaction is and what actions can be considered as completing a transaction.

A transaction is a sequence of database operations that are treated as a single unit of work. These operations can include inserting, updating, or deleting data in the database.

Let's go through each option to understand which statements complete a transaction:

Option A) DELETE employees; - This statement deletes all records from the "employees" table. While it is a valid operation, it does not necessarily complete a transaction as it does not include other necessary operations such as committing or rolling back changes.

Option B) DESCRIBE employees; - This statement describes the structure of the "employees" table. It does not involve any transaction-related operations and does not complete a transaction.

Option C) ROLLBACK TO SAVEPOINT C; - This statement rolls back all changes made since the savepoint named "C." Rolling back changes is an essential part of completing a transaction, as it ensures that any changes made are undone if necessary. Therefore, this statement completes a transaction.

Option D) GRANT SELECT ON employees TO SCOTT; - This statement grants the SELECT privilege on the "employees" table to the user "SCOTT." While it is a valid operation, it does not involve any transaction-related operations and does not complete a transaction.

Option E) ALTER TABLE employees SET UNUSED COLUMN sal; - This statement marks the "sal" column in the "employees" table as unused. It is a valid operation, but it does not involve any transaction-related operations and does not complete a transaction.

Option F) Select MAX(sal) FROM employees WHERE department_id = 20; - This statement retrieves the maximum salary from the "employees" table for the employees in the department with ID 20. It is a valid query, but it does not involve any transaction-related operations and does not complete a transaction.

Based on the above explanations, the correct answers are:

C. ROLLBACK TO SAVEPOINT C; E. ALTER TABLE employees SET UNUSED COLUMN sal;

These two statements complete a transaction as they involve rollbacks and modifications to the database structure.

Find more quizzes: