LIKE Operator

The Like Operator determines whether specified string, such as column value, matches a pattern.  The strength in the LIKE operator lies within its pattern. 

As you see later on, it consists of regular characters and wildcard characters.  The regular character must exactly match their counterpart value. However, the wildcards allow one or more matches. 

Using patterns makes LIKE more flexible than ordinary = and <> operators, as matches go beyond exact literal matching. 

Here is a general use of LIKE within a SQL statement: 

SELECT column1, column2 
FROM table1 
WHERE colum3 LIKE pattern 

LIKE Patterns

The SQL Like Operator

Examples using LIKE

Here are some examples using like.  In this first example we’ll use two wildcards to find all products containing the word Washer.  To do so, we use the % wildcard to match zero or more characters at the beginning or end of washer. 

SELECT ProductID, Name, ProductNumber From Production.Product Where Name LIKE '%Washer%'
SELECT ProductID, Name, ProductNumber 
From Production.Product 
Where Name LIKE '%Washer%'

Additional Resources

To learn more about the LIKE operator, check out these useful resources: 

>