The WHERE clause keeps only the rows that match a condition.
Operators in WHERE
=equal,<>or!=not equal>,<,>=,<=BETWEEN,LIKE,IN(covered in later lessons)
Text values need single quotes: WHERE City = 'Lahore'.
Filter records with conditions.
✍️ 3 exercises + code challenge in this lessonThe WHERE clause keeps only the rows that match a condition.
= equal, <> or != not equal>, <, >=, <=BETWEEN, LIKE, IN (covered in later lessons)Text values need single quotes: WHERE City = 'Lahore'.
Mastering SQL WHERE helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
SELECT * FROM Customers
WHERE Country = 'Pakistan';
SELECT ProductName, Price FROM Products
WHERE Price > 20000;
Check what you learned in “SQL WHERE”.
Filter customers from Lahore.
SELECT * FROM Customers City = 'Lahore';
How are text values written in SQL?
Select the names of products in the "Furniture" category.
Free sign-in required · Google login available
Stuck on something?
Ask the community in the CodesInTech forum.
Need a developer?
Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.
Explore Our Services