Every application you've ever tested has a database behind it. The user accounts you create, the orders you place, the messages you send, the bug reports you file — they all live as rows in a database somewhere. Most of the time the UI and the API are honest narrators of what's in that database, but not always. The skill this course builds is the ability to step around the UI and the API and ask the database directly: "is the data actually right?" That's why testers learn SQL.
What a database actually is
A database is an organised collection of data that software reads from and writes to. Strip away the marketing and that's it — a structured filing system. The most common kind, the one we'll use throughout this course, is a relational database: data lives in tables, tables have columns (fields) and rows (records), and tables relate to each other through shared identifiers.
A useful analogy: imagine a spreadsheet application with many tabs. Each tab is a table — users, products, orders. Each tab has columns at the top and rows below. A single row in users is one user; a single row in orders is one order. The "relational" part is that an order row knows which user it belongs to, because it stores that user's id. That's the whole model. Once you can see a database as a stack of related spreadsheets, the rest of this course is mostly learning how to ask good questions of those spreadsheets.
The popular relational databases all speak almost the same language: PostgreSQL, MySQL, SQL Server, Oracle, and SQLite. There are dialect differences (we'll flag the important ones), but if you can read and write SQL on one, you can do it on all of them.
Where the database fits in the stack
When you click "Place Order" on an e-commerce site, here's roughly what happens:
- – User clicks 'Place Order'
- – Browser / mobile app
- – QA tests via UI: Cypress, Playwright, manual
- – POST /api/orders
- – Server validates + business logic
- – QA tests via API: Postman, REST Assured
- Server INSERTs row into orders –
- Source of truth for the data –
- QA verifies via SQL — this course –
Notice that QA can test at every layer, but only the database layer tells you whether the data actually persisted correctly. The UI shows you what the front-end believes. The API tells you what the server reports. The database is the only one that can't lie about its own state.
Six things SQL unlocks for a tester
You'll use SQL for at least these jobs throughout your QA career:
- Verify data after UI or API operations. "Did the order actually save? With the right total? Linked to the right user?" A
SELECTanswers that in two seconds. - Set up test data. Insert a user, a product, three orders before running a test — no fragile UI clicks, no chained API calls, just a few
INSERTstatements. - Clean up test data. Delete the rows your test created so the next run starts clean. (Cleanup is a core habit covered later in the course.)
- Investigate bugs. "The UI shows the wrong price. What does the database say?" When the UI and the database disagree, you've found a real bug — and you've narrowed down where it lives.
- Validate data migrations. A team migrates 50,000 user records to a new schema. Did every row get the new field?
SELECT COUNT(*) FROM users WHERE new_field IS NULLis your one-line answer. - Generate test reports. Count tests by status, group bugs by severity, find the products with the most refunds — SQL is the tool reporting tools are built on top of.
A quick taste — your first verification query
Here's the kind of query you'll be writing by the end of Chapter 2. After a user places an order through the UI, you check that the order saved correctly:
SELECT id, user_id, total, status, created_at
FROM orders
WHERE user_id = 42
ORDER BY created_at DESC
LIMIT 1;Sample result:
| id | user_id | total | status | created_at |
|-----|---------|--------|----------|---------------------|
| 308 | 42 | 124.50 | pending | 2026-05-06 10:14:22 |
One row. The user_id matches who you logged in as, the total matches what the cart showed, the status is what you'd expect for a fresh order. Five fields, one query, full confidence the order made it to the database. That's the sort of payoff SQL gives a tester.
A note on non-relational databases
Some applications store data in non-relational (NoSQL) systems instead — MongoDB and DynamoDB are common examples. They store documents (chunks of JSON) or key-value pairs rather than rows in tables. They're not covered in this course, but the general "verify the data layer directly" idea still applies — you just use a different query language. Most QA roles still encounter relational databases far more often than NoSQL, so SQL is the right place to start.
If you're already familiar with database verification from the API testing side, this course goes deeper. The Data Integrity and Database Verification lesson from the API Testing Masterclass shows the why; this course teaches you the how — every query you'll need to back up that pattern.
⚠️ Common Mistakes
- Believing the API instead of checking. A 200 OK or 201 Created is the API's report of success, not proof of it. Failed transactions, async writes, and serializer bugs can all return 2xx while the data is wrong. Verify directly when correctness matters.
- Treating the database as off-limits because "I'm not a developer." Read access to the test database is a normal part of QA tooling. If you don't have it yet, ask — it's a five-minute permission change, not a career change.
- Confusing "the database" with "the production database." You'll always practice and verify against test or staging environments, never production. We'll come back to this in the next lesson.
🎯 Practice Task
15 minutes — get comfortable with the idea before any setup.
- Pick any application you use daily — a food delivery app, your bank, a streaming service.
- List five pieces of data that must be living in a database somewhere behind it: e.g., your account, your saved address, your last order, your watchlist, your password (hashed).
- For each one, write a one-sentence "as a tester I'd want to verify…" — for example: "As a tester I'd want to verify that when a user updates their saved address, the new address is what's stored, not the old one."
- Stretch: for one of those items, sketch the rough columns the database table would need. Don't worry about correctness — just practice the mental shift from "data on a screen" to "rows in a table."
Tomorrow we'll formalise that mental model — what tables, columns, rows, and data types actually look like.