Skip to content
techsnow

Reading Data

WHERE

WHERE filters rows so you only get the ones you need.

SELECT name FROM students WHERE city = 'Lahore';
SELECT name FROM students WHERE marks >= 80 AND city = 'Lahore';
SELECT name FROM students WHERE city IN ('Lahore', 'Karachi');
SELECT name FROM students WHERE marks BETWEEN 70 AND 90;
SELECT name FROM students WHERE name LIKE 'S%';   -- starts with S
SELECT name FROM students WHERE city IS NULL;
OperatorMeaning
= <>Equal / not equal
> < >= <=Comparisons
AND OR NOTCombine conditions
IN (...)Matches any value in a list
BETWEEN a AND bIn a range (inclusive)
LIKEPattern: % = any characters, _ = one character
IS NULLHas no value