SQLite 3 reference · String Functions

SQLite GLOB Operator

Match a string against a Unix-style pattern with *, ? and [...]. Unlike LIKE, GLOB is case-sensitive.

SQLite 3

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

X GLOB pattern  |  glob(pattern, X)

Parameters

ParameterDescription
X The string to test.
pattern * any characters, ? one character, [a-z] a set.

Return value

1 (true) or 0 (false).

Examples

Names starting A to DTry it yourself
SELECT name
FROM products
WHERE name GLOB '[A-D]*';

Output

name
Clean Code
Coffee Mug
Desk Lamp
Case-sensitive, unlike LIKETry it yourself
SELECT 'Desk' GLOB 'd*' AS lowercase_pattern, 'Desk' LIKE 'd%' AS with_like;

Output

lowercase_pattern | with_like
0 | 1

Was this page helpful?