Matching part of a text value with wildcards

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Matching part of a text value with wildcards

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which criterion finds every name that STARTS with S?
A Like "S*"
B Like "*S"
2. Which criterion finds every word that ENDS with s?
A Like "*s"
B Like "s*"
3. Which criterion finds every pet name that CONTAINS the letters at anywhere inside it?
A Like "at*"
B Like "*at*"
4. What does the * wildcard stand for in a query criterion?
A Only the letter S
B Any characters, including none
5. Which query criterion is written correctly to find text starting with B?
A Like "B*"
B = "B*"

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1Like "S*" AThe * is on the wrong side. Like "*S" finds names that END with S. To find names that start with S, put the * after the letter: Like "S*".
2Like "*at*" BLike "B*"
3Find names that end with the letter s, like Chris or James CLike "*s"
4The LIKE operator lets a query match part of a text value using a wildcard, for example all towns starting with B DWildcards only work with the LIKE operator. Using = looks for the exact text S* instead. It should be Like "S*".
5Like "*S" to find names that start with S EFinds text that starts with S, such as Sam, Sydney or Soccer
6= "S*" to find names that start with S FFinds text that contains the letters at anywhere, such as cat, atlas or Matt

Definitions

Like "S*"

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
Field: Name Criteria: ____ "S*"
2.
Field: Name Criteria: Like "S_"
3.
Field: Name Criteria: Like "_s"
4.
Field: Pet Criteria: Like "*at_"
5.
SELECT * FROM Pets WHERE Name LIKE 'S_'

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A -- Names that start with S
B SELECT Name FROM Students
C WHERE Name Like "*S";
Question 2
A SELECT Name Age
B FROM Pets
C WHERE Name Like "C*";
Question 3
A -- Titles ending with ing
B SELECT Title FROM Songs
C WHERE Title Like "ing*";
D ORDER BY Title;
Question 4
A SELECT Name FROM Teams
B WHERE Name = "*ers";
C ORDER BY Name;
Question 5
A SELECT Name FROM Players
B WHERE Name Like *a*;
C ORDER BY Name;

Answer Key

Matching part of a text value with wildcards
Section A: Quick Questions
Q1
A — Like "S*"
Q2
A — Like "*s"
Q3
B — Like "*at*"
Q4
B — Any characters, including none
Q5
A — Like "B*"
Section B: Match the Pairs
Q1
Like "S*" → Finds text that starts with S, such as Sam, Sydney or Soccer
Q2
Like "*at*" → Finds text that contains the letters at anywhere, such as cat, atlas or Matt
Q3
Find names that end with the letter s, like Chris or James → Like "*s"
Q4
The LIKE operator lets a query match part of a text value using a wildcard, for example all towns starting with B → Like "B*"
Q5
Like "*S" to find names that start with S → The * is on the wrong side. Like "*S" finds names that END with S. To find names that start with S, put the * after the letter: Like "S*".
Q6
= "S*" to find names that start with S → Wildcards only work with the LIKE operator. Using = looks for the exact text S* instead. It should be Like "S*".
Section C: Definitions
Q1
Like "S*" — A query criterion where the * wildcard stands for any characters, so it finds text that starts with S. Like "*s" ends with s and Like "*at*" contains at.
Section D: Fill in the Blanks
Q1
Field: Name Criteria: Like "S*"
Q2
Field: Name Criteria: Like "S*"
Q3
Field: Name Criteria: Like "*s"
Q4
Field: Pet Criteria: Like "*at*"
Q5
SELECT * FROM Pets WHERE Name LIKE 'S%'
Section E: Spot the Error
Q1
C — The wildcard is on the wrong side. "*S" finds names that END with S. To find names that start with S, the criterion must be Like "S*".
Q2
A — Fields in a SELECT list must be separated by a comma. It should be SELECT Name, Age.
Q3
C — "ing*" finds titles that START with ing. To find titles that end with ing, put the wildcard first: Like "*ing".
Q4
B — The = operator looks for the exact text *ers, so the * is not treated as a wildcard. Use Like "*ers" to find names ending in ers.
Q5
B — The Like pattern is text, so it must be inside quotes. It should be Like "*a*" to find names containing a.