0
0
MySQLquery~5 mins

WHERE clause filtering in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the WHERE clause in SQL?
The WHERE clause is used to filter records and return only those rows that meet a specified condition.
Click to reveal answer
beginner
How do you filter rows where the column age is greater than 30?
Use WHERE age > 30 to select rows where the age value is more than 30.
Click to reveal answer
intermediate
Can the WHERE clause use multiple conditions? How?
Yes, by combining conditions with AND or OR. For example, WHERE age > 30 AND city = 'Paris'.
Click to reveal answer
beginner
What happens if you omit the WHERE clause in a SELECT statement?
All rows from the table are returned because no filtering condition is applied.
Click to reveal answer
intermediate
How do you filter rows where a column name starts with the letter 'A'?
Use the LIKE operator with a wildcard: WHERE name LIKE 'A%'.
Click to reveal answer
Which SQL clause is used to filter rows based on a condition?
ASELECT
BFROM
CWHERE
DORDER BY
What does this SQL do? SELECT * FROM users WHERE age < 18;
ASelects users younger than 18
BSelects users older than 18
CSelects all users
DSelects users exactly 18 years old
How do you combine two conditions in a WHERE clause to require both to be true?
AUsing AND
BUsing NOT
CUsing OR
DUsing LIKE
Which operator is used to match patterns in a WHERE clause?
ABETWEEN
BLIKE
CIN
DIS NULL
What will happen if you run SELECT * FROM products; without a WHERE clause?
AReturns rows with NULL values only
BReturns no rows
CReturns only one row
DReturns all rows from products
Explain how the WHERE clause filters data in a SQL query.
Think about how you pick only certain items from a list based on a rule.
You got /4 concepts.
    Describe how to use multiple conditions in a WHERE clause and what logical operators you can use.
    Consider how you decide if you want to buy something only if it is cheap AND new.
    You got /4 concepts.