Single character match

suggest change

To broaden the selections of a structured query language (SQL-SELECT) statement, wildcard characters, the percent sign (%) and the underscore (_), can be used.

The \_ (underscore) character can be used as a wildcard for any single character in a pattern match.

Find all employees whose FName starts with ‘j’, ends with ‘n’, and is exactly 3 characters. Whether LIKE is case-sensitive depends on the collation.

SELECT * FROM Employees WHERE FName LIKE 'j_n'

The \_ (underscore) character can also be used more than once as a wildcard.

For example, this pattern would match “jon”, “jan”, “jen”, etc.

These names will not be shown: “jn”, “john”, “jordan”, “justin”, “jason”, “julian”, “jillian”, “joann”. One underscore stands for exactly one character, so FName must be exactly three characters.

For example, this pattern would match “LaSt”, “LoSt”, “HaLt”, etc.

SELECT * FROM Employees WHERE FName LIKE '_A_T'

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents