Recall & Review
beginner
What does the
WHERE clause do in an SQL query?The
WHERE clause filters rows in a table based on a condition, so only rows that meet the condition are returned.Click to reveal answer
beginner
Name four common comparison operators used in the
WHERE clause.Common comparison operators are:
= (equal), < (less than), > (greater than), <= (less than or equal), >= (greater than or equal), and <> or != (not equal).Click to reveal answer
beginner
How would you write a query to find all employees with a salary greater than 50000?
Use: <br>
SELECT * FROM employees WHERE salary > 50000;<br>This returns all employees earning more than 50000.Click to reveal answer
beginner
What happens if you omit the
WHERE clause in a SELECT statement?The query returns all rows from the table without filtering, showing every record.
Click to reveal answer
intermediate
Can you use multiple comparison operators together in a
WHERE clause?Yes, by combining conditions with
AND or OR. For example: WHERE age > 20 AND salary < 70000.Click to reveal answer
Which operator checks if two values are equal in a WHERE clause?
✗ Incorrect
The '=' operator tests if two values are equal.
What does the operator '<>' mean in SQL?
✗ Incorrect
The '<>' operator means 'not equal' in SQL.
How do you find rows where a column value is less than or equal to 100?
✗ Incorrect
The '<=' operator means 'less than or equal to'.
Which keyword combines multiple conditions in a WHERE clause so both must be true?
✗ Incorrect
The 'AND' keyword requires both conditions to be true.
What will this query return? <br>SELECT * FROM products WHERE price > 50;
✗ Incorrect
The condition 'price > 50' filters products costing more than 50.
Explain how the WHERE clause works with comparison operators in SQL.
Think about how you pick items from a list based on a rule.
You got /3 concepts.
Describe how to combine multiple conditions in a WHERE clause using comparison operators.
Imagine choosing fruits that are both red AND sweet.
You got /3 concepts.