This section covers the fundamental SQL operations used daily by QA Engineers to validate, query, and inspect backend data.
All queries were executed on the qa_testing database using PostgreSQL.
- Retrieve and filter data using
SELECTandWHERE - Sort and limit results with
ORDER BYandLIMIT - Apply text and range filters with
LIKE,BETWEEN, andIN - Combine multiple conditions using
AND,OR, andNOT - Practice real QA-style data checks (email validation, recent orders, product sanity, etc.)
| Concept | Description | Example |
|---|---|---|
| SELECT | Retrieve data from one or more columns. | SELECT name, city FROM users; |
| WHERE | Filter rows matching specific conditions. | WHERE city = 'London'; |
| ORDER BY | Sort results ascending or descending. | ORDER BY signup_date DESC; |
| LIMIT | Restrict the number of rows returned. | LIMIT 5; |
| LIKE / BETWEEN / IN | Pattern, range, and list filters. | WHERE price BETWEEN 50 AND 200; |
| AND / OR / NOT | Combine or negate conditions. | WHERE city='London' AND price>100; |
This section covers the SQL techniques used to summarise data, perform calculations, and generate QA-style analytical reports.
All queries were executed on the qa_testing database using PostgreSQL.
- Count rows and compute totals using
COUNT(),SUM(),AVG(),MIN(),MAX() - Group data using
GROUP BY - Filter aggregated groups using
HAVING - Build conditional summaries using
CASE WHEN - Produce QA reporting outputs (test summaries, orders per user, city distributions)
| Concept | Description | Example |
|---|---|---|
| COUNT() / SUM() / AVG() | Compute totals and averages. | SELECT COUNT(*) FROM test_results; |
| MIN() / MAX() | Get smallest / largest values. | SELECT MAX(order_date) FROM orders; |
| GROUP BY | Aggregate rows into groups. | GROUP BY city |
| HAVING | Filter groups based on aggregated conditions. | HAVING COUNT(*) >= 2 |
| Conditional Aggregation (CASE) | Create per-status or per-condition summaries. | SUM(CASE WHEN status='passed' THEN 1 END) |
- Database: PostgreSQL (
qa_testingschema) - Client: pgAdmin 4 / psql
- Editor: VS Code
To create the schema locally:
-- Run this file in your PostgreSQL instance:
qa_testing_schema.sql