Filtering with WHERE Clause Flashcards
7 cards from real SQL practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Filtering with WHERE Clause flashcards as text
Which operator is best to find customers whose city is one of several specific values?
Answer: IN
IN tests membership against a discrete list of values efficiently.
What does WHERE score >= 60 AND score <= 90 equal?
Answer: WHERE score BETWEEN 60 AND 90
BETWEEN is the inclusive-range equivalent of two combined comparison operators.
Which condition finds emails ending in '.com'?
Answer: WHERE email LIKE '%.com'
A leading % with '.com' at the end matches any value ending in .com.
What happens with WHERE NOT (price IN (10, 20)) when price is NULL?
Answer: The NULL row is not returned
NOT IN with NULL involvement yields unknown, so the NULL row is excluded.
Which combines two ranges: ages 18-25 OR 60-65?
Answer: WHERE (age BETWEEN 18 AND 25) OR (age BETWEEN 60 AND 65)
Two BETWEEN ranges joined by OR captures both non-contiguous bands.
Why can filtering on an indexed column speed up a WHERE query?
Answer: The index lets the engine locate matching rows without scanning all rows
An index allows the database to seek matching rows instead of a full table scan.
What does WHERE first_name = last_name compare?
Answer: Two columns in the same row against each other
WHERE can compare two columns, returning rows where their values are equal.