# When should I use a database query instead of a write operation?

Canonical URL: https://help.iagenify.com/faqs/databases/when-should-i-use-a-database-query-instead-of-a-write-operation

[← Back to Databases FAQs](https://help.iagenify.com/faqs/databases)

HELP CENTER · FAQ Databases 1 min read
# When should I use a database query instead of a write operation?
Use a query when you need to retrieve or inspect data without changing it. Use a write operation only when the task must insert, update, or delete records, and verify the target rows before applying a change with broad impact.
IaGenify
Databases

## Separate reading from mutation
A read helps answer questions, render a view, or decide what a later step should do. Keeping that step read-only makes it easier to review and reduces the chance that an exploratory action changes production data.
Writes should express a specific business change. Include a narrow condition, bind input values safely, and consider the effect if zero rows or more rows than expected match.
## Validate the intended effect
Before a destructive or bulk write, run a corresponding select with the same filters to inspect the affected records. Use a transaction or a staged process if multiple updates need to succeed as one unit.
After the write, check the returned change count and query the relevant records to confirm the desired state. A command that executes successfully may still affect no rows or produce an outcome that does not satisfy the business requirement. [← Back to Databases FAQs](https://help.iagenify.com/faqs/databases)
