Recall & Review
beginner
What does the CASE statement do inside a WHERE clause?
It allows you to apply conditional logic to decide which rows to include based on different conditions.
Click to reveal answer
beginner
How do you write a simple CASE expression inside a WHERE clause?
Use
WHERE CASE WHEN condition THEN value ELSE other_value END = something to filter rows based on conditions.Click to reveal answer
intermediate
Can CASE in WHERE clause return different columns or just values?
CASE returns values, not columns. It helps decide which value to compare in the WHERE filter.
Click to reveal answer
intermediate
Why use CASE in WHERE instead of multiple OR conditions?
CASE can make complex conditions clearer and easier to manage by grouping logic in one expression.
Click to reveal answer
beginner
Example: How to filter rows where status is 'active' if type is 1, else 'pending'?
Use
WHERE (CASE WHEN type = 1 THEN status ELSE 'pending' END) = 'active' to apply this logic.Click to reveal answer
What does the CASE statement inside a WHERE clause return?
✗ Incorrect
CASE returns a value that the WHERE clause uses to filter rows.
Which keyword is used to start a CASE expression?
✗ Incorrect
The CASE expression always starts with the keyword CASE.
Can you use ELSE in a CASE inside WHERE clause?
✗ Incorrect
ELSE provides a default value if no WHEN condition matches.
Which is a valid use of CASE in WHERE clause?
✗ Incorrect
Option A uses correct CASE syntax with WHEN, THEN, ELSE, and END.
Why might you use CASE in a WHERE clause?
✗ Incorrect
CASE in WHERE helps apply conditional filters to rows.
Explain how CASE can be used inside a WHERE clause to filter data conditionally.
Think about how CASE returns a value that the WHERE clause compares.
You got /5 concepts.
Write a simple example of a SQL query using CASE in the WHERE clause to filter rows based on different conditions.
Try filtering rows where a column value changes the filter condition.
You got /5 concepts.