I have very simple SQLite table:
CREATE TABLE IF NOT EXISTS `settings` (`Name` TEXT PRIMARY KEY, `Value` TEXT);
I use 2 following queries:
SELECT `Value` FROM `settings` WHERE `Name` LIKE 'MainTabControl.active';
(returns 1 row)
and
SELECT `Value` FROM `settings` WHERE `Name` = 'MainTabControl.active';
(returns 0 rows)
Row with Name
column value MainTabControl.active
definitely exists (I see it when do SELECT *
), doesn't have any spaces at beginning and end, and has the same case of all characters.
What is reason of different behavior of equality operator and LIKE
?
sqlite3
-cli and it works.length(Name)
show for that particular field?Name
,Value
, length(Name
) FROMsettings
it returns MainTabControl.active, 3, 21. It worked for me in past, but it stopped when I started to use queries on this DB with "COLLATE NOCASE like that: SELECT * FROMtable
WHEREcol
LIKE '%' || a || '%' COLLATE NOCASE; but it is on another table for this database. May COLLATE used in "where" on another table somehow affectsettings
table?