Modern QA2026Why Query the Database Directly?
Log inJoin
1 / 8 · Book 15 · Your First SELECT -- Reading the Source of Truth · drill: interview Q&A⊞ allnext →Get the book →

1.1Why Query the Database Directly?

Every application has layers. A user clicks a button in the UI, which sends an HTTP request to the API, which executes business logic, which writes data to the database. Each layer can introduce bugs. The database is the final layer -- the source of truth.

Consider this scenario: a user creates an account through your web application. The UI shows "Account created successfully." The API returned HTTP 201. But did the data actually persist? Without querying the database, you are trusting every layer in between.

User Action          UI Response         API Response        Database Reality
-----------          -----------         ------------        ----------------
Click "Register"     "Success!"          201 Created         ???

The database is the only place to verify what ACTUALLY happened.