SQLite where the clause acts weird with the TEXT fields

I searched up and down sqlite.org and cannot understand what it is. I'm used to MySQL, so I think maybe I'm missing something.

See the following code:

sqlite> select id,event_number,must_say from events where id=28; 28|'28'|'AFK' sqlite> select id,event_number,must_say from events where must_say='AFK'; sqlite> select id,event_number,must_say from events where must_say like 'AFK'; sqlite> select id,event_number,must_say from events where must_say like 'A%'; sqlite> select id,event_number,must_say from events where must_say=='AFK'; sqlite> 

Needless to say, I really expected a return for ALL of the above requests, not just the first one:

 28|'28'|'AFK' 

I get this behavior in all TEXT fields. I can't seem to find at all.

Here is a diagram of the table of my events in which irrelevant fields are omitted:

 CREATE TABLE events ( id INTEGER PRIMARY KEY AUTOINCREMENT, EVENT_NUMBER INTEGER, MUST_SAY TEXT ); 

Any ideas? I just want to be able to search by arbitrary text fields in a table.

Edit: I am using SQLite3.

+4
source share
1 answer

You can also have spaces in your columns.

You can see spaces with

 select '|' || must_say || '|' from events 

You can see non-printable using

 select hex(must_say) from events 
0
source

All Articles