Lesson 43 — Database & SQL Basics: Asking the Data Directly · Practical QA
LESSON VIEW
G-03 · LEVEL 2 PRACTITIONER · PRACTICAL QA

Lesson 43 — Database & SQL Basics: Asking the Data Directly

Objective: Read a database table the way a tester needs to — rows, columns, and three plain queries (SELECT, FROM, WHERE, with ORDER BY to sort) — and check one FreshNest booking in the data against what the screen showed, read-only.

⏱ ≈35 min full lesson · Practice site: FreshNest booking form · English edition

🧽 The practice business: FreshNest Home Cleaning — a fictional local cleaning company (owner: Maya Torres) invented for this course. Every example and exercise uses FreshNest, so you learn on a complete, realistic business without ever touching a real one.

⚡ Key Points

  • A database stores records in tables: columns say what a value is, each row is one whole record.
  • FreshNest's quotes table: quote_id, service, bedrooms, price, status, phone — one row per quote.
  • SELECT … FROM … WHERE … is the one query shape a tester needs; ORDER BY sorts the result. SELECT only reads.
  • The screen is the claim, the table is the record — check one against the other, value by value.
  • Testers query read-only: the wrong row is evidence. Never fix data yourself; report it exactly as stored.

📖 Read

When a customer books a FreshNest clean, the screen shows a confirmation — and behind it, the booking is stored. Stored where? In a database: an organised store a program keeps its records in, built from tables. A table is a grid with a fixed set of columns and one row per record. FreshNest's quotes table has columns quote_id, service, bedrooms, price, status and phone. Every quote the site creates becomes one row: Q-1043, standard, 2 bedrooms, 140, QUOTED, and the customer's phone. Column says what a value is; row is one whole record. That is the entire model — if you can picture that grid, you can do everything in this lesson.

SQL — usually said 'sequel' — is the language for asking a table questions. A tester needs exactly one shape of question, and it reads almost like English: SELECT says which columns you want (a star, *, means all of them), FROM says which table, WHERE narrows it to rows that match a condition. SELECT * FROM quotes WHERE service = 'deep' asks: give me every column of every row where the service is deep. Add ORDER BY price and the rows come back sorted by price. Run it, and the answer is a smaller grid — the result. Reading a result means counting rows and checking values, one by one, against what you expected. Nothing here changes the data: SELECT only reads.

Here is why a tester bothers. The screen is the site's claim; the table is the record. Check one against the other: the screen priced a Standard 2-bedroom clean at $140 — the rule's price — so you query that row and expect price 140. In the practice data, most rows agree. One does not: row Q-1048 is stored as a Standard 2-bedroom quote priced at $168 — a number that belongs to no rule (Standard is $140; Deep would be $210). And row Q-1049 carries a phone with only 9 digits, breaking the exactly-10-digits rule the form was supposed to enforce. The screen never showed you either problem. You do not need a clever query to find them: SELECT * FROM quotes, read all eight rows against the rules, and the two bad rows stand out. This is the foundation the API lesson builds on: send a request, then check the record it left behind.

One discipline matters from your very first query: testers query read-only. You SELECT; you never UPDATE, INSERT or DELETE in a real system, for two plain reasons. First, evidence: the wrong row is the proof of the bug — fix the data and the proof is gone, and the bug is still in the code waiting for the next customer. Second, safety: a careless change can corrupt records other people depend on. If data needs fixing, that is a developer's change, reviewed and logged — your job is to find the row, report it exactly as stored, and let the fix happen where fixes belong.