2 SQL Queries Every QA Should Know (Part 2)
In Part 1, I discussed database types and why QAs need to learn how to do the READ operations.
Now let's dive into the actual SQL commands you'll use daily.
[`User` Table]
──────────────
ID │ Name │ Email
──────────────
1 │ john │ john@test.com
2 │ mary | mary@test.com
3 │ bob │ bob@test.com
──────────────
────────────────────────────────
▶ 𝐐𝐮𝐞𝐫𝐲 #𝟏: 𝐁𝐚𝐬𝐢𝐜 `𝐒𝐄𝐋𝐄𝐂𝐓` - 𝐑𝐞𝐚𝐝 𝐀𝐥𝐥 𝐃𝐚𝐭𝐚
······································································································································
SELECT * FROM Users;
······································································································································
What it does: Returns ALL columns and ALL rows from the Users table.
QA Example: After registering multiple users, you want to see all newly created accounts in the database.
────────────────────────────────
▶ 𝐐𝐮𝐞𝐫𝐲 #𝟐: `𝐒𝐄𝐋𝐄𝐂𝐓 𝐖𝐢𝐭𝐡 𝐖𝐇𝐄𝐑𝐄` - 𝐅𝐢𝐥𝐭𝐞𝐫𝐞𝐝 𝐑𝐞𝐚𝐝
·····································································································································
SELECT * FROM Users WHERE Email = 'bob@test.com';
······································································································································
What it does: Returns all data in the row for the user with that specific email address:
──────────────
𝟑 │ 𝐛𝐨𝐛 │ 𝐛𝐨𝐛@𝐭𝐞𝐬𝐭.𝐜𝐨𝐦
──────────────
QA Example: Test user registration and verify that exact account was created with correct details.
────────────────────────────────
𝐓𝐢𝐩𝐬:
⟡ Start with `𝐒𝐄𝐋𝐄𝐂𝐓 *` to see all data, then add `𝐖𝐇𝐄𝐑𝐄` to narrow it down
⟡ Always test your queries on a test database first, never production
𝐏.𝐒. 🚩 𝐈𝐟 𝐲𝐨𝐮 𝐡𝐚𝐯𝐞𝐧’𝐭 𝐰𝐚𝐭𝐜𝐡𝐞𝐝 𝐢𝐭 𝐲𝐞𝐭, 𝐲𝐨𝐮𝐫 𝐧𝐞𝐱𝐭 𝐬𝐭𝐞𝐩 𝐢𝐬 𝐭𝐡𝐞 𝐅𝐑𝐄𝐄 𝟑-𝐩𝐚𝐫𝐭 “𝐌𝐚𝐧𝐮𝐚𝐥 𝐐𝐀 → 𝐒𝐃𝐄𝐓” 𝐰𝐨𝐫𝐤𝐬𝐡𝐨𝐩, 𝐚 𝐬𝐡𝐨𝐫𝐭 𝐦𝐢𝐧𝐢-𝐜𝐨𝐮𝐫𝐬𝐞 𝐭𝐡𝐚𝐭 𝐠𝐢𝐯𝐞𝐬 𝐲𝐨𝐮 𝐭𝐡𝐞 𝐟𝐮𝐥𝐥 𝐫𝐨𝐚𝐝𝐦𝐚𝐩 𝐭𝐨 𝐛𝐞𝐜𝐨𝐦𝐢𝐧𝐠 𝐚 𝐦𝐢𝐝-𝐥𝐞𝐯𝐞𝐥 𝐒𝐃𝐄𝐓 𝐚𝐧𝐝 𝐩𝐚𝐬𝐬𝐢𝐧𝐠 𝐢𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰𝐬.
8
0 comments
Matviy Cherniavski
6
2 SQL Queries Every QA Should Know (Part 2)
QA Automation Accelerator
skool.com/qa-automation-career-hub
Become a job-ready QA Automation Engineer/SDET in 3–4 months. AI-powered prep, real SaaS project, Certificate of Completion, and live support. 🚀
Leaderboard (30-day)
Powered by