I’m trying to use Northwind version in SQLite (someone posted it on Github and it’s super handy), but my query for selecting employees with last name starting with B, C, D, …, L using LIKE
returns empty table:
SELECT Title FROM Employees WHERE LastName LIKE '[B-L]%'
The table contains such names (most of them, in fact). Does SQLite not support character range in LIKE
with []
?
Advertisement
Answer
SQLite does not support this SQL Server – like functionallity that you want.
You can do it with SUBSTR()
:
WHERE SUBSTR(LastName, 1, 1) BETWEEN 'B' AND 'L'
or:
WHERE LastName >= 'B' AND LastName < 'M'