Ad space (banner)
🗄️SQL Lessons
Lesson 27 / 50

Pattern Matching with GLOB

This lesson covers pattern matching with GLOB, and clarifies how it differs from LIKE. It's for anyone searching "SQL GLOB tutorial" or "SQLite GLOB vs LIKE."

GLOB is a pattern-matching operator similar to LIKE, using * for "any sequence of characters" and ? for "any single character" — and unlike LIKE, it's case-sensitive.

The example uses WHERE name GLOB 'A*' to search for names starting with "A." Notice it uses a different wildcard symbol (*) than the % you saw with LIKE — comparing the two side by side helps them both stick.

A common early mistake is not realizing GLOB is SQLite-specific — it looks a lot like the shell wildcards you might already know from filenames (*.txt), so it can feel intuitive if you're comfortable with a command line, but keep in mind it's SQLite's own extension and won't necessarily work on other databases. It's useful whenever you need case-sensitive pattern matching, or you're already fluent in shell-style wildcards and it just feels more natural.

SQL
OUTPUT

💡 The SQL engine may take a few seconds to load the first time you run code.

Ad space (banner)
Ad space (in-article)