WHERE – Filtering Rows in SQL Like a Boss

Quick Syntax

SELECT column1, column2
FROM table_name
WHERE condition;

Alright, here’s the vibe: You’ve got a table full of stuff — names, cities, orders, whatever. But you don’t want everything. You just want some rows. Maybe people over 30, or users from a certain city.

That’s when you bring in WHERE. It’s like telling SQL: “Show me only the rows where this thing is true.”

Let me walk you through it like we’re at the same desk, coffee in hand.


Say You Have This Table Called clients

idnameagecitysubscription
1Renzo Blip41Driftwoodfree
2Moxi Tern24Cloudhillpro
3Jara NixDustvalebasic
4Kito Grail31Cloudhillfree
5Fenn Rask27trial
6Lume Paddo45Driftwoodpro

No famous names, no perfect data — just a funky little table you need to work with.


Suppose You Want People in Cloudhill

SELECT name, city
FROM clients
WHERE city = 'Cloudhill';

Output:

Moxi Tern   Cloudhill  
Kito Grail  Cloudhill

Now You Only Want Clients Over 30

SELECT name, age
FROM clients
WHERE age > 30;

Output:

Renzo Blip   41  
Kito Grail   31  
Lume Paddo   45

Let’s Say You’re Hunting Free Plan Users

SELECT name, subscription
FROM clients
WHERE subscription = 'free';

Output:

Renzo Blip   free  
Kito Grail   free

Missing Info? Use IS NULL

SELECT name, age
FROM clients
WHERE age IS NULL;

Output:

Jara Nix   NULL

Note: Use IS NULL — not = NULL. That won’t work.


Wanna Combine Conditions? Easy.

Now let’s say you want people who:

  • Live in Driftwood
  • AND are on a pro plan
SELECT name, city, subscription
FROM clients
WHERE city = 'Driftwood' AND subscription = 'pro';

Output:

Lume Paddo   Driftwood   pro

Recap – Here’s What You Learned

  • WHERE helps you filter rows
  • Use operators like =, >, <, !=
  • Use IS NULL for missing values
  • Combine conditions with AND / OR
  • It’s like spreadsheet filters — but with superpowers


Now that you know how WHERE works, next let’s check out DISTINCT.
It helps you get results with no repeats — like a list of all different cities, not every single row.
See how it works here.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top