What do SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, COMMIT and ROLLBACK do?
Answer
SELECT reads data; INSERT, UPDATE and DELETE change rows; and CREATE, ALTER and DROP define or change database objects. COMMIT makes a transaction's successful work durable, while ROLLBACK abandons its uncommitted changes. A tester should know which statements can change state, restrict write access in shared environments, use precise WHERE clauses and verify both the affected-row count and resulting business state.
Strong answer includes
- separates querying, data changes, schema changes and transaction control
- recognizes destructive-statement risk
- verifies affected rows and final state
Practical example
Runs against the resettable SQLite sample database used by the playground.
Run the query to see the result.
SELECT is used as a safe preview, UPDATE changes state, and the explicit transaction keeps the operation reversible while it is being verified. The same separation applies to INSERT/DELETE, while CREATE/ALTER/DROP change schema objects.
Expected result: The rows change inside the transaction and return to their previous state after ROLLBACK.