Before you start
You need Workbench and a running SQL engine. Every example includes its own input rows. No catalog, files, credentials, or external data is needed. These queries create no stored tables. Copy the SQL into Workbench and run the statements in order. Compare the result with the table below the query.WITH names input data for one statement only. Each example can run on its own.
1. Compare values
Which orders are worth at least 25?
WHERE keeps only rows whose condition is true.
Change one thing: Use > 25. Expect orders 2 and 4.
2. Combine conditions
Which North orders exceed 15?
AND requires both conditions.
Change one thing: Use amount >= 15. Order 3 is also included.
3. Use parentheses
Which North orders or large South orders qualify?
Parentheses make the intended rule clear.
Change one thing: Use amount >= 25. All six orders qualify.
4. Select a range
Which values are between 15 and 25?
BETWEEN includes both ends.
Change one thing: Change 25 to 20. Expect orders 1 and 3.
5. Match lists and text
Which selected categories start with G?
IN checks a list. LIKE uses % for any sequence of characters.
Change one thing: Change G% to Ga%. The result stays the same.
6. Classify orders
Which orders are large?
CASE chooses the first matching branch.
Change one thing: Set the threshold to 25. Order 5 becomes Large.