2002-08-30 20:32:59 +02:00
|
|
|
|
drop table if exists t1,t2;
|
2001-09-28 07:05:54 +02:00
|
|
|
|
create table t1 (name char(20) not null, primary key (name));
|
|
|
|
|
create table t2 (name char(20) binary not null, primary key (name));
|
|
|
|
|
insert into t1 values ("<22>");
|
|
|
|
|
insert into t1 values ("<22>");
|
|
|
|
|
insert into t1 values ("<22>");
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
select * from t1 order by name;
|
2000-12-28 02:56:38 +01:00
|
|
|
|
name
|
|
|
|
|
<EFBFBD>
|
|
|
|
|
<EFBFBD>
|
|
|
|
|
<EFBFBD>
|
2001-09-28 07:05:54 +02:00
|
|
|
|
select concat("*",name,"*") from t1 order by 1;
|
2000-12-28 02:56:38 +01:00
|
|
|
|
concat("*",name,"*")
|
|
|
|
|
*<2A>*
|
|
|
|
|
*<2A>*
|
|
|
|
|
*<2A>*
|
2001-09-28 07:05:54 +02:00
|
|
|
|
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t1;
|
2000-12-28 02:56:38 +01:00
|
|
|
|
min(name) min(concat("*",name,"*")) max(name) max(concat("*",name,"*"))
|
|
|
|
|
<EFBFBD> *<2A>* <09> *<2A>*
|
2001-09-28 07:05:54 +02:00
|
|
|
|
select * from t2 order by name;
|
2000-12-28 02:56:38 +01:00
|
|
|
|
name
|
|
|
|
|
<EFBFBD>
|
|
|
|
|
<EFBFBD>
|
|
|
|
|
<EFBFBD>
|
2001-09-28 07:05:54 +02:00
|
|
|
|
select concat("*",name,"*") from t2 order by 1;
|
2000-12-28 02:56:38 +01:00
|
|
|
|
concat("*",name,"*")
|
|
|
|
|
*<2A>*
|
|
|
|
|
*<2A>*
|
|
|
|
|
*<2A>*
|
2001-09-28 07:05:54 +02:00
|
|
|
|
select min(name),min(concat("*",name,"*")),max(name),max(concat("*",name,"*")) from t2;
|
2000-12-28 02:56:38 +01:00
|
|
|
|
min(name) min(concat("*",name,"*")) max(name) max(concat("*",name,"*"))
|
|
|
|
|
<EFBFBD> *<2A>* <09> *<2A>*
|
2001-09-28 07:05:54 +02:00
|
|
|
|
select name from t1 where name between '<27>' and '<27>';
|
2000-12-28 02:56:38 +01:00
|
|
|
|
name
|
|
|
|
|
<EFBFBD>
|
|
|
|
|
<EFBFBD>
|
2001-09-28 07:05:54 +02:00
|
|
|
|
select name from t2 where name between '<27>' and '<27>';
|
2000-12-28 02:56:38 +01:00
|
|
|
|
name
|
|
|
|
|
<EFBFBD>
|
|
|
|
|
<EFBFBD>
|
|
|
|
|
<EFBFBD>
|
2001-09-28 07:05:54 +02:00
|
|
|
|
select name from t2 where name between '<27>' and '<27>';
|
2000-12-28 02:56:38 +01:00
|
|
|
|
name
|
2001-09-28 07:05:54 +02:00
|
|
|
|
drop table t1,t2;
|
2003-02-03 09:17:47 +01:00
|
|
|
|
create table t1 (a char(10) not null, b char(10) binary not null,key (a), key(b));
|
2001-09-28 07:05:54 +02:00
|
|
|
|
insert into t1 values ("hello ","hello "),("hello2 ","hello2 ");
|
2003-03-06 15:29:55 +01:00
|
|
|
|
select concat("-",a,"-",b,"-") from t1 where a="hello";
|
|
|
|
|
concat("-",a,"-",b,"-")
|
|
|
|
|
-hello-hello-
|
|
|
|
|
select concat("-",a,"-",b,"-") from t1 where a="hello ";
|
|
|
|
|
concat("-",a,"-",b,"-")
|
|
|
|
|
-hello-hello-
|
|
|
|
|
select concat("-",a,"-",b,"-") from t1 ignore index (a) where a="hello ";
|
|
|
|
|
concat("-",a,"-",b,"-")
|
|
|
|
|
-hello-hello-
|
|
|
|
|
select concat("-",a,"-",b,"-") from t1 where b="hello";
|
|
|
|
|
concat("-",a,"-",b,"-")
|
|
|
|
|
-hello-hello-
|
|
|
|
|
select concat("-",a,"-",b,"-") from t1 where b="hello ";
|
|
|
|
|
concat("-",a,"-",b,"-")
|
|
|
|
|
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
|
|
|
|
|
concat("-",a,"-",b,"-")
|
2003-02-03 09:17:47 +01:00
|
|
|
|
alter table t1 modify b tinytext not null, drop key b, add key (b(100));
|
2003-03-06 15:29:55 +01:00
|
|
|
|
select concat("-",a,"-",b,"-") from t1 where b="hello ";
|
|
|
|
|
concat("-",a,"-",b,"-")
|
2003-12-17 16:35:34 +01:00
|
|
|
|
-hello-hello-
|
2003-03-06 15:29:55 +01:00
|
|
|
|
select concat("-",a,"-",b,"-") from t1 ignore index (b) where b="hello ";
|
|
|
|
|
concat("-",a,"-",b,"-")
|
|
|
|
|
-hello-hello-
|
2001-09-28 07:05:54 +02:00
|
|
|
|
drop table t1;
|
2002-09-18 01:21:29 +02:00
|
|
|
|
create table t1 (b char(8));
|
|
|
|
|
insert into t1 values(NULL);
|
|
|
|
|
select b from t1 where binary b like '';
|
|
|
|
|
b
|
|
|
|
|
select b from t1 group by binary b like '';
|
|
|
|
|
b
|
|
|
|
|
NULL
|
|
|
|
|
select b from t1 having binary b like '';
|
|
|
|
|
b
|
|
|
|
|
drop table t1;
|