How to create SQLite with LIKE and Get forward/backward/partial match data

Published on:
Last updated:

This post is also available in: 日本語 (Japanese)

This post is about how to get forward/backward/partial match data by fuzzy matching using SQLite with WHERE or LIKE.
As for the full text search method of SQLite, there is a full text search module called FTS in SQLite.

Contents

SQLite partial match search (fuzzy search)

If you want to do partial match search(fuzzy search) for the string 'abc' in SQLite.

SELECT * FROM Your-Table-Name WHERE Your-Column-Name LIKE '%abc%'

SQLite forward search (fuzzy search)

If you want to do forward match search(fuzzy search) for the string 'abc' in SQLite.

SELECT * FROM Your-Table-Name WHERE Your-Column-Name LIKE 'abc%'

SQLite backward match search(fuzzy search)

If you want to do backward match search(fuzzy search) for the string 'abc' in SQLite.

SELECT * FROM Your-Table-Name WHERE Your-Column-Name LIKE '%abc'

About
Kuniyoshi Takemoto is the founder of Amelt.net LLC, and editor of this blog(www.amelt.net).Learn more and follow me on LinkedIn.