📄 func_like.result
字号:
drop table if exists t1;create table t1 (a varchar(10), key(a));insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");explain select * from t1 where a like 'abc%';id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 index a a 13 NULL 5 Using where; Using indexexplain select * from t1 where a like concat('abc','%');id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 index a a 13 NULL 5 Using where; Using indexselect * from t1 where a like "abc%";aabcabcdselect * from t1 where a like concat("abc","%");aabcabcdselect * from t1 where a like "ABC%";aabcabcdselect * from t1 where a like "test%";atestselect * from t1 where a like "te_t";atestselect * from t1 where a like "%a%";aaabcabcdselect * from t1 where a like "%abcd%";aabcdselect * from t1 where a like "%abc\d%";aabcddrop table t1;create table t1 (a varchar(10), key(a));insert into t1 values ('a'), ('a\\b');select * from t1 where a like 'a\\%' escape '#';aa\bselect * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';aa\bprepare stmt1 from 'select * from t1 where a like \'a\\%\' escape ?';set @esc='#';execute stmt1 using @esc;aa\bdeallocate prepare stmt1;drop table t1;create table t1 (a datetime);insert into t1 values ('2004-03-11 12:00:21');select * from t1 where a like '2004-03-11 12:00:21';a2004-03-11 12:00:21drop table t1;SET NAMES koi8r;CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r);INSERT INTO t1 VALUES ('瀑琢'),('尜琢'),('迄琢'),('瀑髁'),('瀑揍'),('纟麽');INSERT INTO t1 VALUES ('瀑琢幸咸闹'),('尜琢幸咸闹'),('迄琢幸咸闹'),('瀑髁幸咸闹');INSERT INTO t1 VALUES ('瀑揍幸咸闹'),('瀑琢鹨咸闹'),('瀑琢序咸闹'),('瀑琢幸锾闹');INSERT INTO t1 VALUES ('瀑琢幸响闹'),('瀑琢幸咸渲'),('瀑琢幸咸啮'),('纟麽痱镬漩');SELECT * FROM t1 WHERE a LIKE '%迄琢%';a瀑琢尜琢迄琢瀑髁瀑揍纟麽瀑琢幸咸闹尜琢幸咸闹迄琢幸咸闹瀑髁幸咸闹瀑揍幸咸闹瀑琢鹨咸闹瀑琢序咸闹瀑琢幸锾闹瀑琢幸响闹瀑琢幸咸渲瀑琢幸咸啮纟麽痱镬漩SELECT * FROM t1 WHERE a LIKE '%迄
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -