🟢 Beginner Level: SQL Fundamentals
Welcome to the world of databases! SQL (Structured Query Language) is the standard language used to communicate with databases. As a QA Tester, SQL is your superpower to verify if front-end actions are correctly reflected in the back-end database.
💡 Analogy for Easy Understanding
Think of a Database as a physical Filing Cabinet. Inside it, each drawer contains Excel Sheets. In SQL, these sheets are called Tables. Each vertical column in the sheet is a Column (attribute), and each row of data is a Row (record).
Our Practice Database Tables
We have prepared a realistic QA database with 5 tables for you to practice:
employees- Staff info (name, role, salary, department)departments- Department names & office locationsprojects- Team projects and financial budgetstesters- QA Testers who validate the softwarebugs- Logged software defects, severity, and status
Lesson 1 The SELECT Statement
The SELECT statement is used to fetch (read) data from a table. The asterisk * means "Select all columns".
Lesson 2 Selecting Specific Columns
To avoid messy layouts and keep data clean, list the exact columns you want to view, separated by commas.
🧠 Quick Knowledge Check
What does the asterisk (*) stand for in the query: SELECT * FROM bugs;?
🔵 Intermediate Level: Filtering & Sorting
Now that we can fetch data, let's learn how to filter out unnecessary rows and sort our output. This is vital when validating search and sorting features in software.
💡 Analogy for Easy Understanding
Think of the WHERE clause as the **filter funnel icon** in Excel. Instead of scrolling through 10,000 rows to find one customer, you "filter" by a condition (like `country = 'India'`).
Lesson 1 The WHERE Clause (Filtering)
Use the WHERE clause to extract only records that match a strict criteria (like numbers, strings, or booleans).
| Operator | Meaning | Example Use Case |
|---|---|---|
= |
Equal to | Find user with ID 5: WHERE id = 5 |
> / < |
Greater / Less than | Find high-salary workers: WHERE salary > 60000 |
LIKE |
Pattern matching | Names starting with 'A': WHERE name LIKE 'A%' |
Lesson 2 ORDER BY (Sorting)
Use ORDER BY to sort your output alphabetically or numerically. Use DESC for descending (highest to lowest) or ASC for ascending.
Lesson 3 The LIKE Operator (Wildcard search)
What if you only know part of a name? Use LIKE with the % wildcard (which stands for zero, one, or multiple characters).
LIKE '%gmail.com').
🧠 Quick Knowledge Check
Which operator would you use to filter employees who make more than 50,000?
🟣 Advanced Level: Joins & Aggregations
Great progress! In real companies, data is split into multiple tables to keep it neat. Here we will learn how to do basic math calculations and link multiple tables together.
💡 Analogy for Easy Understanding
Think of a JOIN as linking two puzzle pieces.
If the employees sheet has a column called `dept_id`, and the departments sheet has a column called `dept_id`, a JOIN matches these IDs to combine the information!
Lesson 1 Aggregate Functions (Calculations)
Sometimes you don't want to read thousands of rows; you just want a single calculated number.
SQL provides built-in calculators: COUNT(), SUM(), AVG(), MAX(), and MIN().
Lesson 2 GROUP BY (Summarizing Data)
Use GROUP BY to group rows that have identical values together. It is always used alongside aggregate calculations to get clean counts.
Lesson 3 INNER JOIN (Linking Tables)
An INNER JOIN selects records that have matching keys in both tables.
🧠 Quick Knowledge Check
Which SQL aggregate function counts the total number of rows returned?
🔴 Expert Level: Real QA Use Cases
Welcome to the top tier! Here are realistic scenarios software testing teams execute daily to validate data integrity and find system defects.
QA Scenario 1 Bug Logger & Verification
Goal: Find which tester logged critical bugs so the developer can contact them for testing logs. We JOIN the `bugs` table with the `testers` table.
QA Scenario 2 Budget Threshold Check
Goal: Verify if employees assigned to high-budget projects match their expected payroll brackets. We join the employees and projects.
🧠 Final Knowledge Check
Why is SQL an essential skill for manual and automation QA engineers?
Available Mock Tables Click table to quick-preview data!
employees (id, name, role, salary, dept_id, project_id)departments (dept_id, dept_name, location)projects (project_id, project_name, budget)testers (tester_id, name, experience_years)bugs (bug_id, title, status, severity, tester_id)Hands-On Practice Challenges
Completed: 0/5Test your skills! Select a challenge below, write the correct SQL query in the terminal, and click Run Query to unlock achievements!
SQL Query Terminal
Result Set
Execute a query to fetch data from the mock database.
SQL Cheat Sheet
SELECT- Fetch dataWHERE- Filter recordsORDER BY- Sort resultsGROUP BY- Aggregate dataLIMIT- Restrict row countLIKE- Pattern matching
Interview QA Tips
WHERE filters rows before aggregation, while HAVING filters groups after aggregation.
PK uniquely identifies a record. FK links to a PK in another table to establish table relationships.
INNER JOIN returns records that have matching values in both tables. LEFT JOIN returns all records from the left table, even with no matches.
QA Testing Use Cases
- ✔ Validate Missing Data (NULLs)
- ✔ Find Duplicate Records (GROUP BY)
- ✔ Compare Expected vs Actual Output
- ✔ Verify Database Constraints