ACID & Basic Transactions

Preview — 3 of 10 questions

What best describes a database transaction?

AA single SQL SELECT statement executed against the database
BA network connection from an application to the database server
CA scheduled background job that runs periodically to clean up old data
DA group of one or more SQL statements executed as a single logical unit of work — either all succeed or all fail together

What is the correct SQL syntax to start a transaction, execute a statement, and save the changes permanently?

javascript
BEGIN;
  UPDATE accounts SET balance = balance - 100 WHERE id = 1;
  UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;
ASTART; INSERT INTO orders ...; SAVE;
BOPEN TRANSACTION; INSERT INTO orders ...; CLOSE TRANSACTION;
CLOCK; INSERT INTO orders ...; UNLOCK;
DBEGIN; INSERT INTO orders ...; COMMIT;

Which ACID property does this scenario illustrate? A bank transfer debits $100 from Account A. The system crashes before crediting Account B. On restart, Account A still has its original balance.

AAtomicity
BIsolation
CDurability
DConsistency

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.