Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
Databases, SQL & BISQL languageJuniorCommonTheory

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

Preview a write and keep a rollback path
Dialect · Portable SQLRuntime · SQLite sample DB

Runs against the resettable SQLite sample database used by the playground.

SQL
SQLite · sample DB · browser sandbox
Result
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.

#sql#crud#ddl#transactions

Sources

PostgreSQL documentationPostgreSQL Global Development Group · Relational modelling, SQL, joins, constraints, transactions, concurrency, indexes, query plans and recovery