0
0
SQLquery~5 mins

WHERE with comparison operators in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
A=
B<
C>
D!=
What does the operator '<>' mean in SQL?
ALess than
BGreater than
CNot equal
DEqual
How do you find rows where a column value is less than or equal to 100?
AWHERE column <= 100
BWHERE column >= 100
CWHERE column = 100
DWHERE column > 100
Which keyword combines multiple conditions in a WHERE clause so both must be true?
AOR
BAND
CNOT
DBETWEEN
What will this query return? <br>SELECT * FROM products WHERE price > 50;
AProducts with price exactly 50
BAll products
CProducts with price less than 50
DProducts with price greater 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.