⚡ 0 XP
Step 1 of 2
Matching text
WHERE keeps only the rows for which a condition is true. It comes after FROM:
SELECT name FROM players WHERE team = 'Delhi';
- Text goes in single quotes:
'Delhi' - Text must match exactly:
'delhi' is not 'Delhi' <> means “not equal”: WHERE role <> 'Bowler'
Think of WHERE as a sieve (छलनी): every row is tested, only the true ones pass through.
ExampleSELECT name, role
FROM players
WHERE team = 'Delhi';
🎯 Challenge: The Mumbai squad +10 XP
Show name and role of the players whose team is Mumbai.
Try twice to unlock the solution (0/2)
query.sqlCtrl ⏎
Tables (practice database)
Results
Press Run to see your query’s rows here.
Checklist
Press Run to check your code.
Lesson notes (text version)
1. Matching text
WHERE keeps only the rows for which a condition is true. It comes after FROM:
SELECT name FROM players WHERE team = 'Delhi';
- Text goes in single quotes:
'Delhi' - Text must match exactly:
'delhi' is not 'Delhi' <> means “not equal”: WHERE role <> 'Bowler'
Think of WHERE as a sieve (छलनी): every row is tested, only the true ones pass through.
SELECT name, role
FROM players
WHERE team = 'Delhi';
Challenge: The Mumbai squad
Show name and role of the players whose team is Mumbai.
2. Comparing numbers
For numbers you can use >, <, >= (at least) and <= (at most). Numbers need no quotes:
SELECT name, wickets FROM players WHERE wickets >= 50;
Careful with words: “more than 1000” is > 1000 (1000 itself is not included), while “1000 or more” is >= 1000.
SELECT name, wickets
FROM players
WHERE wickets >= 50;
Challenge: The 1000-run club
Show name and runs of every player who scored more than 1000 runs.