Recall & Review
beginner
What does the SQL LIKE operator do?
The LIKE operator is used to search for a specified pattern in a column. It helps find rows where the column's value matches the pattern.
Click to reveal answer
beginner
What does the % symbol mean in a LIKE pattern?
The % symbol matches zero or more characters of any kind. For example, 'a%' matches any string starting with 'a'.
Click to reveal answer
beginner
What does the _ (underscore) symbol mean in a LIKE pattern?
The _ symbol matches exactly one character. For example, '_at' matches 'cat', 'bat', but not 'at' or 'chat'.
Click to reveal answer
beginner
How would you write a query to find all names that end with 'son'?
Use: SELECT * FROM table WHERE name LIKE '%son'; This finds all names ending with 'son'.
Click to reveal answer
intermediate
Can LIKE be case sensitive in MySQL?
By default, LIKE is case-insensitive in MySQL for non-binary strings. But it can be case-sensitive if the column uses a binary collation.
Click to reveal answer
Which wildcard matches any number of characters in a LIKE pattern?
✗ Incorrect
The % wildcard matches zero or more characters in a LIKE pattern.
What does the pattern '_at' match in a LIKE query?
✗ Incorrect
The _ matches exactly one character, so '_at' matches three-letter strings ending with 'at'.
How do you find rows where a column starts with 'abc' using LIKE?
✗ Incorrect
The pattern 'abc%' matches any string starting with 'abc'.
Is the LIKE operator case sensitive by default in MySQL?
✗ Incorrect
LIKE is case insensitive by default for non-binary strings but depends on the column's collation.
Which query finds all rows where 'city' contains 'York' anywhere?
✗ Incorrect
The pattern '%York%' matches any string containing 'York' anywhere.
Explain how the LIKE operator works and how to use % and _ wildcards in pattern matching.
Think about searching for words that start, end, or contain certain letters.
You got /4 concepts.
Describe how case sensitivity affects LIKE queries in MySQL and how it can be controlled.
Consider how uppercase and lowercase letters are treated in searches.
You got /4 concepts.