ExamGecko
Question list
Search
Search

List of questions

Search

Question 36 - ARA-C01 discussion

Report
Export

What are characteristics of the use of transactions in Snowflake? (Select TWO).

A.
Explicit transactions can contain DDL, DML, and query statements.
Answers
A.
Explicit transactions can contain DDL, DML, and query statements.
B.
The autocommit setting can be changed inside a stored procedure.
Answers
B.
The autocommit setting can be changed inside a stored procedure.
C.
A transaction can be started explicitly by executing a begin work statement and end explicitly by executing a commit work statement.
Answers
C.
A transaction can be started explicitly by executing a begin work statement and end explicitly by executing a commit work statement.
D.
A transaction can be started explicitly by executing a begin transaction statement and end explicitly by executing an end transaction statement.
Answers
D.
A transaction can be started explicitly by executing a begin transaction statement and end explicitly by executing an end transaction statement.
E.
Explicit transactions should contain only DML statements and query statements. All DDL statements implicitly commit active transactions.
Answers
E.
Explicit transactions should contain only DML statements and query statements. All DDL statements implicitly commit active transactions.
Suggested answer: A, D

Explanation:

In Snowflake, a transaction is a sequence of SQL statements that are processed as an atomic unit. All statements in the transaction are either applied (i.e. committed) or undone (i.e. rolled back) together. Snowflake transactions guarantee ACID properties.A transaction can include both reads and writes1.

Explicit transactions are transactions that are started and ended explicitly by using the BEGIN TRANSACTION, COMMIT, and ROLLBACK statements. Snowflake supports the synonyms BEGIN WORK and BEGIN TRANSACTION, and COMMIT WORK and ROLLBACK WORK. Explicit transactions can contain DDL, DML, and query statements. However, explicit transactions should contain only DML statements and query statements, because DDL statements implicitly commit active transactions.This means that any changes made by the previous statements in the transaction are applied, and any changes made by the subsequent statements in the transaction are not part of the same transaction1.

The other options are not correct because:

B) The autocommit setting can be changed inside a stored procedure, but this does not affect the use of transactions in Snowflake. The autocommit setting determines whether each statement is executed in its own implicit transaction or not. If autocommit is enabled, each statement is committed automatically. If autocommit is disabled, each statement is executed in an implicit transaction until an explicit COMMIT or ROLLBACK is issued.Changing the autocommit setting inside a stored procedure only affects the statements within the stored procedure, and does not affect the statements outside the stored procedure2.

C) A transaction can be started explicitly by executing a BEGIN WORK statement and end explicitly by executing a COMMIT WORK statement, but this is not a characteristic of the use of transactions in Snowflake. This is just one way of writing the statements that start and end an explicit transaction.Snowflake also supports the synonyms BEGIN TRANSACTION and COMMIT, which are recommended over BEGIN WORK and COMMIT WORK1.

D) A transaction can be started explicitly by executing a BEGIN TRANSACTION statement and end explicitly by executing an END TRANSACTION statement, but this is not a valid syntax in Snowflake. Snowflake does not support the END TRANSACTION statement.The correct way to end an explicit transaction is to use the COMMIT or ROLLBACK statement1.

1:Transactions | Snowflake Documentation

2: AUTOCOMMIT | Snowflake Documentation

asked 23/09/2024
AHMED MAHMOUD NASR Hassan
31 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first