Recall & Review
beginner
What is the purpose of the WHERE clause in a database query?
The WHERE clause filters rows in a table to return only those that meet a specified condition.
Click to reveal answer
beginner
How does the WHERE clause affect the result of a SELECT query?
It limits the rows returned by the query to only those that satisfy the condition in the WHERE clause.
Click to reveal answer
beginner
Which of these is a valid WHERE clause condition?<br>
WHERE age > 30 or WHERE name = 'John'?Both are valid. The first filters rows where age is greater than 30, the second filters rows where the name is exactly 'John'.
Click to reveal answer
intermediate
Can the WHERE clause use multiple conditions? How?
Yes, by combining conditions with AND, OR, and parentheses to control logic, e.g., WHERE age > 20 AND city = 'Paris'.
Click to reveal answer
beginner
What happens if you omit the WHERE clause in a SELECT query?
The query returns all rows from the table without filtering.
Click to reveal answer
What does the WHERE clause do in a SQL query?
✗ Incorrect
The WHERE clause filters rows to include only those that meet the specified condition.
Which operator can be used to combine multiple conditions in a WHERE clause?
✗ Incorrect
AND combines multiple conditions so all must be true for a row to be included.
What will this query return? SELECT * FROM users WHERE age < 18;
✗ Incorrect
The WHERE clause filters to include only users with age less than 18.
If you want to find rows where city is 'London' or 'Paris', which WHERE clause is correct?
✗ Incorrect
Both A and D correctly filter rows where city is either London or Paris.
What happens if the WHERE clause condition is always false?
✗ Incorrect
If the condition is always false, no rows match and the result is empty.
Explain how the WHERE clause filters data in a database query.
Think about how you pick only certain items from a list based on a rule.
You got /3 concepts.
Describe how to combine multiple conditions in a WHERE clause and why you might do that.
Imagine choosing items that meet several rules at once or one of several rules.
You got /4 concepts.