SQL WHERE Clause: I Thought I Knew It… Until It Asked Me About LIKE 😭

Published: (January 7, 2026 at 11:54 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

What is the WHERE Clause?

The WHERE clause is basically SQL’s filter button.
You don’t want all rows – you want specific rows.

SELECT * FROM students;

All rows

SELECT * FROM students
WHERE marks > 80;

Only the smart kids

That’s it. That’s the purpose.

Big Picture: WHERE Operators (Mental Map)

Think of WHERE operators in five categories:

CategoryPurpose
Comparison OperatorsCompare values
Logical OperatorsCombine conditions
Range OperatorTest a value between two bounds
Membership OperatorCheck membership in a list
Search OperatorPattern matching (LIKE)

Now let’s break them down one by one.

Comparison Operators (The Ones Everyone Knows… Mostly)

These compare one value with another.

OperatorMeaning
=equal
!= or <>not equal
>greater than
>=greater than or equal
<less than
<=less than or equal

Logical Operators

OperatorMeaning
ANDBoth conditions must be true
ORAt least one condition must be true
NOTNegates a condition

Range Operator

OperatorSyntax
BETWEENBETWEEN x AND y – checks if a value lies within a range (inclusive)

Membership Operator

OperatorSyntax
ININ (a, b, c) – checks if a value matches any value in a list

Search Operator

OperatorSyntax
LIKELIKE '%text%' – pattern matching with wildcards (% for any sequence, _ for a single character)

Quick Reference Cheat Sheet

CategoryExample
CombineAND, OR, NOT
RangeBETWEEN x AND y
ListIN (a, b, c)
PatternLIKE '%text%'

Keep this sheet handy, and the WHERE clause will always be your friend.

I genuinely thought I knew the WHERE clause.
But knowing the names of operators and knowing how to write them correctly are two very different things.

This article is my revision note, my syntax reminder, and my future interview backup.

Back to Blog

Related posts

Read more »