Learn SQL/Beginner/Filtering Data/SQL Wildcards (% and _)

SQL Wildcards (% and _)

Two characters, two very different jobs — any-length match versus exactly-one-character match.

What & Why

% matches any sequence of characters, including zero. _ matches exactly one character, no more, no less.

See How It Works

PATTERNS THAT MATCH `Spring Launch`
PatternWhy it matches 'Spring Launch'
`Spring%`Starts with "Spring"; % allows any remaining characters.
`%Launch`Ends with "Launch"; % allows any prefix.
`Spring_Launch`_ matches the single space between the two words.
`Spring_______`Seven underscores match exactly the seven characters in " Launch".

% matches any number of characters, while _ matches exactly one character.

Now You Try

Practice this concept

Product wants features whose names end with App, using a wildcard pattern rather than exact equality.

Available schema
product

Prefix tables with product.table_name.

nameteamreleased_at
product.features
ColumnType
idinteger
nametext
descriptiontext
teamtext
released_attimestamp with time zone
deprecated_attimestamp with time zone
internal_priorityinteger
query.sql
Beginner business practice

Sign up free to try it on a real business scenario