bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL LIKE Operator

Concept visual

SQL LIKE Operator

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

Start at both ends

The SQL LIKE Operator

The LIKE

operator is used in a WHERE clause to search for a specified pattern within a column's text data. There are two wildcards often used in conjunction with the LIKE operator:

A percent sign

% - represents zero, one, or multiple characters

A underscore sign

_ - represents a single character The following SQL selects all customers that starts with "a":

Example

Select all customers that starts with the letter "a":

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

Syntax

Select

column1, column2, ...

From

table_name

Where

columnN

Like

pattern

;

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

Previous

SQL AVG() Function

Next

SQL Wildcards