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
| Operator | Row survives when... |
|---|---|
| AND | every condition is true |
| OR | at least one condition is true |
| NOT | the 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
productPrefix tables with product.table_name.
user_idratingnps_scoreproduct.feedback| Column | Type |
|---|---|
| id | integer |
| user_id | integer |
| feature_id | integer |
| rating | integer |
| nps_score | integer |
| comment | text |
| created_at | timestamp with time zone |
| moderation_bucket | text |
query.sql
Sign up free to try it on a real business scenario