mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
aafca9f08d
INDEX+LIKE, don't take the ESCAPE character. (ver. 2)
48 lines
1 KiB
Text
48 lines
1 KiB
Text
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%';
|
|
table type possible_keys key key_len ref rows Extra
|
|
t1 range a a 11 NULL 1 Using where; Using index
|
|
explain select * from t1 where a like concat('abc','%');
|
|
table type possible_keys key key_len ref rows Extra
|
|
t1 range a a 11 NULL 1 Using where; Using index
|
|
select * from t1 where a like "abc%";
|
|
a
|
|
abc
|
|
abcd
|
|
select * from t1 where a like concat("abc","%");
|
|
a
|
|
abc
|
|
abcd
|
|
select * from t1 where a like "ABC%";
|
|
a
|
|
abc
|
|
abcd
|
|
select * from t1 where a like "test%";
|
|
a
|
|
test
|
|
select * from t1 where a like "te_t";
|
|
a
|
|
test
|
|
select * from t1 where a like "%a%";
|
|
a
|
|
a
|
|
abc
|
|
abcd
|
|
select * from t1 where a like "%abcd%";
|
|
a
|
|
abcd
|
|
select * from t1 where a like "%abc\d%";
|
|
a
|
|
abcd
|
|
drop 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 '#';
|
|
a
|
|
a\b
|
|
select * from t1 where a like 'a\\%' escape '#' and a like 'a\\\\b';
|
|
a
|
|
a\b
|
|
drop table t1;
|