Learn SQL/Beginner/Filtering Data/SQL Logical Operators

SQL Logical Operators

AND, OR, and NOT, side by side — the three ways to combine or flip conditions.

What & Why

Every filtering condition beyond a single comparison is built from these three: AND (every condition must hold), OR (at least one must hold), NOT (flip a condition's truth value).

See How It Works

REFERENCE EXAMPLE
OperatorRow survives when...
ANDevery condition is true
ORat least one condition is true
NOTthe wrapped condition is false

The result uses the same Queryflo columns shown in the worked example.

Now You Try

Practice this concept

Product wants strong feedback records from promoters: high rating and high NPS.

Available schema
product

Prefix tables with product.table_name.

user_idratingnps_score
product.feedback
ColumnType
idinteger
user_idinteger
feature_idinteger
ratinginteger
nps_scoreinteger
commenttext
created_attimestamp with time zone
moderation_buckettext
query.sql
Beginner business practice

Sign up free to try it on a real business scenario