SQLite where子句在TEXT字段中表现异常

前端之家收集整理的这篇文章主要介绍了SQLite where子句在TEXT字段中表现异常前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在sqlite.org上搜索过,无法想出这个.我已经习惯了 MySQL,所以我想也许我会忽略一些东西.

请参阅以下代码

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

不用说,我真的希望所有上述查询都返回以下内容,而不仅仅是第一个:

28|'28'|'AFK'

我在所有TEXT字段上都有这种行为.好像我根本无法搜索.

这是我的事件表的模式,省略了不相关的字段:

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

有任何想法吗?我只是希望能够通过表格中的任意文本字段进行搜索.

编辑:我正在使用sqlite3.

解决方法

您的列中也可能有空格.

你可以看到空格

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

你可以看到unprintables

select hex(must_say) from events

猜你在找的Sqlite相关文章