SQL LITE

LIKE is used in the WHERE clause to search for a pattern.

LIKE SQL syntax

SELECT column (s) FROM table WHERE column LIKE '% pattern%'

Examples of using SQL LIKE

Given the following table 'people'

namesurnamenickname
HARRYCLARKWHITE
HARRYSMITHJOHNSON
JOHNBROWNANDERSON

If I select the names starting with 'AN' on table 'people', execute the following command:

SELECT * FROM people WHERE name LIKE 'AN%'

The character '%' is a wildcard, which serves one or more characters.

This is the result

namesurnamenickname
HARRYCLARKWHITE
HARRYSMITHJOHNSON

Another example of SQL LIKE

To select the people who have a 'Z' in his surname, would execute:

SELECT * FROM people WHERE surname LIKE '% Z%'
namesurnamenickname
HARRYCLARKWHITE
JOHNBROWNANDERSON