SQL Wildcards
Posted on
< Previous Next >
The underscore wildcard represents a single character in a search pattern.
For example, The search pattern "s_mith" would match strings such as "smith" and "smyth", but not "smoith" or "smithy".
Here's an example of how to use the underscore wildcard in a SELECT statement with the student table:
Suppose you want to select all students whose name starts with "J" and is followed by any single character, and then followed by "hn".
You can use the underscore wildcard as follows:
SELECT * FROM student
WHERE name LIKE 'J_hn';
OUTPUT

In this above example,
This query will select all students whose name matches the pattern "J_nhn", where the underscore represents any single character.
< Previous Next >