bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL Wildcards

Concept visual

SQL Wildcards

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

SQL Wildcard Characters

A wildcard character is used to substitute one or more characters in a string.

Wildcard characters are used with the LIKE

operator. The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.

Example

Return all customers that starts with the letter 'a':

SELECT * FROM Customers
WHERE CustomerName LIKE 'a%';

Wildcard Characters

Symbol

Description

%

Represents zero or more characters

_

Represents a single character

[] Represents any single character within the brackets * ^ Represents any character not in the brackets *

Represents any single character within the specified range *

{}

Represents any escaped character * Not supported in PostgreSQL and MySQL databases. Supported only in Oracle databases.

Demo Database

Below is a selection from the

Customers table used in the examples:

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

Alfreds Futterkiste

Maria Anders

Obere Str. 57

Berlin

12209

Germany

Ana Trujillo Emparedados y helados

Ana Trujillo

Avda. de la Constitución 2222 México D.F. 05021

Mexico

Antonio Moreno Taquería

Previous

SQL LIKE Operator

Next

SQL IN Operator