SQLite Like % and _

后端 未结 4 1669
盖世英雄少女心
盖世英雄少女心 2020-12-09 07:18

I can\'t figure out what the underscore character does in an SQLite like statement. The wildcard character, %, is probably the same as in most othe

4条回答
  •  庸人自扰
    2020-12-09 07:50

    Addendum to @Benoit's answer:

    The ESCAPE applies to the most recent LIKE expression, not all LIKE expressions. To escape all you must use ESCAPE multiple times, such as below.

    WHERE foo LIKE '%bar^%%' ESCAPE '^' AND foo LIKE '%baz^_%' ESCAPE '^'
    

    This predicate matches values of foo which contain bar%, or baz plus any character.

提交回复
热议问题