Complete the code to start a distributed transaction in SQL.
BEGIN [1] TRANSACTION;The DISTRIBUTED keyword is used to start a distributed transaction that spans multiple databases or nodes.
Complete the code to prepare a transaction in the two-phase commit protocol.
PREPARE [1];In the two-phase commit protocol, the PREPARE TRANSACTION command is used to prepare the transaction for commit.
Fix the error in the two-phase commit SQL command to finalize the transaction.
COMMIT [1];The correct command to finalize a prepared transaction is COMMIT WORK. This commits the transaction that was previously prepared.
Fill both blanks to create a dictionary comprehension that maps transaction IDs to their status if the status is 'prepared'.
{ [1]: [2] for [1] in transactions if transactions[[1]] == 'prepared' }The variable tx_id is used as the key and state as the value in the dictionary comprehension. The comprehension filters transactions with status 'prepared'.
Fill all three blanks to write a SQL query that selects transaction IDs, their status, and the coordinator node from a distributed transaction log where status is 'committed'.
SELECT [1], [2], [3] FROM transaction_log WHERE status = 'committed';
The query selects transaction_id, status, and coordinator_node columns to show committed transactions and their coordinator.