Modern QA2026Question 3
Log inJoin
7 / 7 · Book 15 · Your First SELECT -- Reading the Source of Truth · drill: interview Q&A← prev⊞ allGet the book →

1.20Question 3

Prompt: You need to verify that a soft-delete feature works correctly. The API returns 204 on DELETE, and the user no longer appears in the GET /users list. How would you verify this at the database level, and what edge cases would you check?

What a strong answer should cover:

  • Confirming deleted_at is set to a recent timestamp (not NULL)
  • Confirming the row still exists (it is a soft delete, not a hard delete)
  • Checking that other fields (name, email) remain intact
  • Edge cases: double-delete, re-activation, cascade effects on related records

Example answer:

  • I would query SELECT id, email, deleted_at FROM users WHERE email = '<test_email>' and assert the row still exists with deleted_at set to a timestamp within the last few seconds.
  • I would verify the row is excluded from the application's "active users" query by checking WHERE deleted_at IS NULL returns no match, while WHERE deleted_at IS NOT NULL does.
  • Edge cases I would test: calling DELETE twice on the same user (idempotency), attempting to re-activate a soft-deleted user, and verifying that the user's orders and profiles are still intact (soft delete should not cascade to related records unless the business rules specify otherwise).