~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/range.result

Merged vcol stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
drop table if exists t1, t2, t3;
2
 
CREATE TABLE t1 (
3
 
event_date date NULL,
4
 
type int DEFAULT '0' NOT NULL,
5
 
event_id int DEFAULT '0' NOT NULL,
6
 
PRIMARY KEY (event_date,type,event_id)
7
 
);
8
 
INSERT INTO t1 VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25),
9
 
('1999-07-13',100600,0), ('1999-07-13',100600,4), ('1999-07-13',100600,26),
10
 
('1999-07-14',100600,10), ('1999-07-15',100600,16), ('1999-07-15',100800,45),
11
 
('1999-07-15',101000,47), ('1999-07-16',100800,46), ('1999-07-20',100600,5),
12
 
('1999-07-20',100600,27), ('1999-07-21',100600,11), ('1999-07-22',100600,17),
13
 
('1999-07-23',100100,39), ('1999-07-24',100100,39), ('1999-07-24',100500,40),
14
 
('1999-07-25',100100,39), ('1999-07-27',100600,1), ('1999-07-27',100600,6),
15
 
('1999-07-27',100600,28), ('1999-07-28',100600,12), ('1999-07-29',100500,41),
16
 
('1999-07-29',100600,18), ('1999-07-30',100500,41), ('1999-07-31',100500,41),
17
 
('1999-08-01',100700,34), ('1999-08-03',100600,7), ('1999-08-03',100600,29),
18
 
('1999-08-04',100600,13), ('1999-08-05',100500,42), ('1999-08-05',100600,19),
19
 
('1999-08-06',100500,42), ('1999-08-07',100500,42), ('1999-08-08',100500,42),
20
 
('1999-08-10',100600,2), ('1999-08-10',100600,9), ('1999-08-10',100600,30),
21
 
('1999-08-11',100600,14), ('1999-08-12',100600,20), ('1999-08-17',100500,8),
22
 
('1999-08-17',100600,31), ('1999-08-18',100600,15), ('1999-08-19',100600,22),
23
 
('1999-08-24',100600,3), ('1999-08-24',100600,32), ('1999-08-27',100500,43),
24
 
('1999-08-31',100600,33), ('1999-09-17',100100,37), ('1999-09-18',100100,37),
25
 
('1999-09-19',100100,37), ('2000-12-18',100700,38);
26
 
select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
27
 
event_date      type    event_id
28
 
1999-07-10      100100  24
29
 
1999-07-11      100100  25
30
 
1999-07-13      100600  0
31
 
1999-07-13      100600  4
32
 
1999-07-13      100600  26
33
 
1999-07-14      100600  10
34
 
explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
35
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
36
 
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    Impossible WHERE
37
 
select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099;
38
 
event_date      type    event_id
39
 
1999-07-10      100100  24
40
 
1999-07-11      100100  25
41
 
1999-07-13      100600  0
42
 
1999-07-13      100600  4
43
 
1999-07-13      100600  26
44
 
1999-07-14      100600  10
45
 
1999-07-15      100600  16
46
 
drop table t1;
47
 
CREATE TABLE t1 (
48
 
PAPER_ID int DEFAULT '0' NOT NULL,
49
 
YEAR int DEFAULT '0' NOT NULL,
50
 
ISSUE int DEFAULT '0' NOT NULL,
51
 
CLOSED int DEFAULT '0' NOT NULL,
52
 
ISS_DATE date,
53
 
PRIMARY KEY (PAPER_ID,YEAR,ISSUE)
54
 
);
55
 
INSERT INTO t1 VALUES (3,1999,34,0,'1999-07-12'), (1,1999,111,0,'1999-03-23'),
56
 
(1,1999,222,0,'1999-03-23'), (3,1999,33,0,'1999-07-12'),
57
 
(3,1999,32,0,'1999-07-12'), (3,1999,31,0,'1999-07-12'),
58
 
(3,1999,30,0,'1999-07-12'), (3,1999,29,0,'1999-07-12'),
59
 
(3,1999,28,0,'1999-07-12'), (1,1999,40,1,'1999-05-01'),
60
 
(1,1999,41,1,'1999-05-01'), (1,1999,42,1,'1999-05-01'),
61
 
(1,1999,46,1,'1999-05-01'), (1,1999,47,1,'1999-05-01'),
62
 
(1,1999,48,1,'1999-05-01'), (1,1999,49,1,'1999-05-01'),
63
 
(1,1999,50,0,'1999-05-01'), (1,1999,51,0,'1999-05-01'),
64
 
(1,1999,200,0,'1999-06-28'), (1,1999,52,0,'1999-06-28'),
65
 
(1,1999,53,0,'1999-06-28'), (1,1999,54,0,'1999-06-28'),
66
 
(1,1999,55,0,'1999-06-28'), (1,1999,56,0,'1999-07-01'),
67
 
(1,1999,57,0,'1999-07-01'), (1,1999,58,0,'1999-07-01'),
68
 
(1,1999,59,0,'1999-07-01'), (1,1999,60,0,'1999-07-01'),
69
 
(3,1999,35,0,'1999-07-12');
70
 
select YEAR,ISSUE from t1 where PAPER_ID=3 and (YEAR>1999 or (YEAR=1999 and ISSUE>28))  order by YEAR,ISSUE;
71
 
YEAR    ISSUE
72
 
1999    29
73
 
1999    30
74
 
1999    31
75
 
1999    32
76
 
1999    33
77
 
1999    34
78
 
1999    35
79
 
check table t1;
80
 
Table   Op      Msg_type        Msg_text
81
 
test.t1 check   status  OK
82
 
drop table t1;
83
 
CREATE TABLE t1 (
84
 
id int NOT NULL auto_increment,
85
 
parent_id int DEFAULT '0' NOT NULL,
86
 
level int DEFAULT '0' NOT NULL,
87
 
PRIMARY KEY (id),
88
 
KEY parent_id (parent_id),
89
 
KEY level (level)
90
 
);
91
 
INSERT INTO t1 VALUES (1,0,0), (3,1,1), (4,1,1), (8,2,2), (9,2,2), (17,3,2),
92
 
(22,4,2), (24,4,2), (28,5,2), (29,5,2), (30,5,2), (31,6,2), (32,6,2), (33,6,2),
93
 
(203,7,2), (202,7,2), (20,3,2), (157,0,0), (193,5,2), (40,7,2), (2,1,1),
94
 
(15,2,2), (6,1,1), (34,6,2), (35,6,2), (16,3,2), (7,1,1), (36,7,2), (18,3,2),
95
 
(26,5,2), (27,5,2), (183,4,2), (38,7,2), (25,5,2), (37,7,2), (21,4,2),
96
 
(19,3,2), (5,1,1), (179,5,2);
97
 
SELECT * FROM t1 WHERE level = 1 AND parent_id = 1;
98
 
id      parent_id       level
99
 
2       1       1
100
 
3       1       1
101
 
4       1       1
102
 
5       1       1
103
 
6       1       1
104
 
7       1       1
105
 
SELECT * FROM t1 WHERE level = 1 AND parent_id = 1 order by id;
106
 
id      parent_id       level
107
 
2       1       1
108
 
3       1       1
109
 
4       1       1
110
 
5       1       1
111
 
6       1       1
112
 
7       1       1
113
 
drop table t1;
114
 
create table t1(
115
 
Satellite               varchar(25)     not null,
116
 
SensorMode              varchar(25)     not null,
117
 
FullImageCornersUpperLeftLongitude      double  not null,
118
 
FullImageCornersUpperRightLongitude     double  not null,
119
 
FullImageCornersUpperRightLatitude      double  not null,
120
 
FullImageCornersLowerRightLatitude      double  not null,
121
 
index two (Satellite, SensorMode, FullImageCornersUpperLeftLongitude, FullImageCornersUpperRightLongitude, FullImageCornersUpperRightLatitude, FullImageCornersLowerRightLatitude));
122
 
insert into t1 values("OV-3","PAN1",91,-92,40,50);
123
 
insert into t1 values("OV-4","PAN1",91,-92,40,50);
124
 
select * from t1 where t1.Satellite = "OV-3" and t1.SensorMode = "PAN1" and t1.FullImageCornersUpperLeftLongitude > -90.000000 and t1.FullImageCornersUpperRightLongitude < -82.000000;
125
 
Satellite       SensorMode      FullImageCornersUpperLeftLongitude      FullImageCornersUpperRightLongitude     FullImageCornersUpperRightLatitude      FullImageCornersLowerRightLatitude
126
 
OV-3    PAN1    91      -92     40      50
127
 
drop table t1;
128
 
create table t1 ( aString char(100) not null default "", key aString (aString(10)) );
129
 
insert t1 (aString) values ( "believe in myself" ), ( "believe" ), ("baaa" ), ( "believe in love");
130
 
select * from t1 where aString < "believe in myself" order by aString;
131
 
aString
132
 
baaa
133
 
believe
134
 
believe in love
135
 
select * from t1 where aString > "believe in love" order by aString;
136
 
aString
137
 
believe in myself
138
 
alter table t1 drop key aString;
139
 
select * from t1 where aString < "believe in myself" order by aString;
140
 
aString
141
 
baaa
142
 
believe
143
 
believe in love
144
 
select * from t1 where aString > "believe in love" order by aString;
145
 
aString
146
 
believe in myself
147
 
drop table t1;
148
 
CREATE TEMPORARY TABLE t1 (
149
 
t1ID int NOT NULL auto_increment,
150
 
art varbinary(1) NOT NULL default '',
151
 
KNR char(5) NOT NULL default '',
152
 
RECHNR char(6) NOT NULL default '',
153
 
POSNR char(2) NOT NULL default '',
154
 
ARTNR char(10) NOT NULL default '',
155
 
TEX char(70) NOT NULL default '',
156
 
PRIMARY KEY  (t1ID),
157
 
KEY IdxArt (art),
158
 
KEY IdxKnr (KNR),
159
 
KEY IdxArtnr (ARTNR)
160
 
) ENGINE=MyISAM;
161
 
INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
162
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
163
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
164
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
165
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
166
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
167
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
168
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
169
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
170
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
171
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
172
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
173
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
174
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
175
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
176
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
177
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
178
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
179
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
180
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
181
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
182
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
183
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
184
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
185
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
186
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
187
 
('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),
188
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
189
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
190
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
191
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
192
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
193
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
194
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
195
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
196
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
197
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),
198
 
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j');
199
 
select count(*) from t1 where upper(art) = 'J';
200
 
count(*)
201
 
213
202
 
select count(*) from t1 where art = 'J' or art = 'j';
203
 
count(*)
204
 
602
205
 
select count(*) from t1 where art = 'j' or art = 'J';
206
 
count(*)
207
 
602
208
 
select count(*) from t1 where art = 'j';
209
 
count(*)
210
 
389
211
 
select count(*) from t1 where art = 'J';
212
 
count(*)
213
 
213
214
 
drop table t1;
215
 
create table t1 (x int, y int, index(x), index(y));
216
 
insert into t1 (x) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
217
 
update t1 set y=x;
218
 
explain select * from t1, t1 t2 where t1.y = 8 and t2.x between 7 and t1.y+0;
219
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
220
 
1       SIMPLE  t1      ref     y       y       5       const   1       Using where
221
 
1       SIMPLE  t2      range   x       x       5       NULL    2       Using where; Using join buffer
222
 
explain select * from t1, t1 t2 where t1.y = 8 and t2.x >= 7 and t2.x <= t1.y+0;
223
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
224
 
1       SIMPLE  t1      ref     y       y       5       const   1       Using where
225
 
1       SIMPLE  t2      range   x       x       5       NULL    2       Using where; Using join buffer
226
 
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between t1.y-1 and t1.y+1;
227
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
228
 
1       SIMPLE  t1      ref     y       y       5       const   1       Using where
229
 
1       SIMPLE  t2      range   x       x       5       NULL    3       Using where; Using join buffer
230
 
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= t1.y-1 and t2.x <= t1.y+1;
231
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
232
 
1       SIMPLE  t1      ref     y       y       5       const   1       Using where
233
 
1       SIMPLE  t2      range   x       x       5       NULL    3       Using where; Using join buffer
234
 
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
235
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
236
 
1       SIMPLE  t1      ref     y       y       5       const   1       Using where
237
 
1       SIMPLE  t2      range   x       x       5       NULL    2       Using where; Using join buffer
238
 
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
239
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
240
 
1       SIMPLE  t1      ref     y       y       5       const   1       Using where
241
 
1       SIMPLE  t2      range   x       x       5       NULL    2       Using where; Using join buffer
242
 
explain select count(*) from t1 where x in (1);
243
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
244
 
1       SIMPLE  t1      ref     x       x       5       const   1       Using where; Using index
245
 
explain select count(*) from t1 where x in (1,2);
246
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
247
 
1       SIMPLE  t1      index   x       x       5       NULL    9       Using where; Using index
248
 
drop table t1;
249
 
CREATE TABLE t1 (key1 int NOT NULL default '0', KEY i1 (key1));
250
 
INSERT INTO t1 VALUES (0),(0),(0),(0),(0),(1),(1);
251
 
CREATE TABLE t2 (keya int NOT NULL default '0', KEY j1 (keya));
252
 
INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
253
 
explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
254
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
255
 
1       SIMPLE  t2      ref     j1      j1      4       const   1       Using index
256
 
1       SIMPLE  t1      index   i1      i1      4       NULL    7       Using where; Using index; Using join buffer
257
 
explain select * from t1 force index(i1), t2 force index(j1) where 
258
 
(t1.key1 <t2.keya + 1) and t2.keya=3;
259
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
260
 
1       SIMPLE  t2      ref     j1      j1      4       const   1       Using index
261
 
1       SIMPLE  t1      index   i1      i1      4       NULL    7       Using where; Using index; Using join buffer
262
 
DROP TABLE t1,t2;
263
 
CREATE TEMPORARY TABLE t1 (
264
 
a int default NULL,
265
 
b int default NULL,
266
 
KEY a (a),
267
 
KEY b (b)
268
 
) ENGINE=MyISAM;
269
 
INSERT INTO t1 VALUES
270
 
(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,2),(10,2),
271
 
(13,2),(14,2),(15,2),(16,2),(17,3),(17,3),(16,3),(17,3),(19,3),(20,3),
272
 
(21,4),(22,5),(23,5),(24,5),(25,5),(26,5),(30,5),(31,5),(32,5),(33,5),
273
 
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
274
 
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
275
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
276
 
1       SIMPLE  t1      range   a,b     a       5       NULL    2       Using where
277
 
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
278
 
a       b
279
 
DROP TABLE t1;
280
 
CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b));
281
 
INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0);
282
 
INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0);
283
 
SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1);
284
 
COUNT(*)
285
 
6
286
 
SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1);
287
 
COUNT(*)
288
 
6
289
 
DROP TABLE t1;
290
 
CREATE TABLE t1 ( a int not null, b int not null, INDEX ab(a,b) );
291
 
INSERT INTO t1 VALUES (47,1), (70,1), (15,1), (15, 4);
292
 
SELECT * FROM t1
293
 
WHERE
294
 
(
295
 
( b =1 AND a BETWEEN 14 AND 21 ) OR
296
 
( b =2 AND a BETWEEN 16 AND 18 ) OR
297
 
( b =3 AND a BETWEEN 15 AND 19 ) OR
298
 
(a BETWEEN 19 AND 47)
299
 
);
300
 
a       b
301
 
15      1
302
 
47      1
303
 
DROP TABLE t1;
304
 
CREATE TEMPORARY TABLE t1 (
305
 
id int NOT NULL AUTO_INCREMENT ,
306
 
line int NOT NULL default '0',
307
 
columnid int NOT NULL default '0',
308
 
owner int NOT NULL default '0',
309
 
ordinal int NOT NULL default '0',
310
 
showid int NOT NULL default '1',
311
 
tableid int NOT NULL default '1',
312
 
content int NOT NULL default '188',
313
 
PRIMARY KEY ( owner, id ) ,
314
 
KEY menu( owner, showid, columnid ) ,
315
 
KEY `COLUMN` ( owner, columnid, line ) ,
316
 
KEY `LINES` ( owner, tableid, content, id ) ,
317
 
KEY recount( owner, line ) 
318
 
) ENGINE = MYISAM;
319
 
INSERT into t1 (owner,id,columnid,line) values (11,15,15,1),(11,13,13,5);
320
 
SELECT id, columnid, tableid, content, showid, line, ordinal FROM t1 WHERE owner=11 AND ((columnid IN ( 15, 13, 14 ) AND line IN ( 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 31 )) OR (columnid IN ( 13, 14 ) AND line IN ( 15 ))) LIMIT 0 , 30;
321
 
id      columnid        tableid content showid  line    ordinal
322
 
13      13      1       188     1       5       0
323
 
15      15      1       188     1       1       0
324
 
drop table t1;
325
 
create  table t1 (id int primary key);
326
 
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
327
 
select id from t1 where id in (2,5,9) ;
328
 
id
329
 
2
330
 
5
331
 
9
332
 
select id from t1 where id=2 or id=5 or id=9 ;
333
 
id
334
 
2
335
 
5
336
 
9
337
 
drop table t1;
338
 
create table t1 ( id1 int not null, id2 int not null, idnull int null, c char(20), primary key (id1,id2));
339
 
insert into t1 values (0,1,NULL,"aaa"), (1,1,NULL,"aaa"), (2,1,NULL,"aaa"),
340
 
(3,1,NULL,"aaa"), (4,1,NULL,"aaa"), (5,1,NULL,"aaa"),
341
 
(6,1,NULL,"aaa"), (7,1,NULL,"aaa"), (8,1,NULL,"aaa"),
342
 
(9,1,NULL,"aaa"), (10,1,NULL,"aaa"), (11,1,NULL,"aaa"),
343
 
(12,1,NULL,"aaa"), (13,1,NULL,"aaa"), (14,1,NULL,"aaa"),
344
 
(15,1,NULL,"aaa"), (16,1,NULL,"aaa"), (17,1,NULL,"aaa"),
345
 
(18,1,NULL,"aaa"), (19,1,NULL,"aaa"), (20,1,NULL,"aaa");
346
 
select a.id1, b.idnull from t1 as a, t1 as b where a.id2=1 and a.id1=1 and b.id1=a.idnull order by b.id2 desc limit 1;
347
 
id1     idnull
348
 
drop table t1;
349
 
create table t1 (
350
 
id int not null auto_increment,
351
 
name char(1) not null,
352
 
uid int not null,
353
 
primary key (id),
354
 
index uid_index (uid));
355
 
create table t2 (
356
 
id int not null auto_increment,
357
 
name char(1) not null,
358
 
uid int not null,
359
 
primary key (id),
360
 
index uid_index (uid));
361
 
insert into t1(id, uid, name) values(1, 0, ' ');
362
 
insert into t1(uid, name) values(0, ' ');
363
 
insert into t2(uid, name) select uid, name from t1;
364
 
insert into t1(uid, name) select uid, name from t2;
365
 
insert into t2(uid, name) select uid, name from t1;
366
 
insert into t1(uid, name) select uid, name from t2;
367
 
insert into t2(uid, name) select uid, name from t1;
368
 
insert into t1(uid, name) select uid, name from t2;
369
 
insert into t2(uid, name) select uid, name from t1;
370
 
insert into t1(uid, name) select uid, name from t2;
371
 
insert into t2(uid, name) select uid, name from t1;
372
 
insert into t1(uid, name) select uid, name from t2;
373
 
insert into t2(uid, name) select uid, name from t1;
374
 
insert into t2(uid, name) select uid, name from t1;
375
 
insert into t2(uid, name) select uid, name from t1;
376
 
insert into t2(uid, name) select uid, name from t1;
377
 
insert into t1(uid, name) select uid, name from t2;
378
 
delete from t2;
379
 
insert into t2(uid, name) values 
380
 
(1, CHAR(64+1)),
381
 
(2, CHAR(64+2)),
382
 
(3, CHAR(64+3)),
383
 
(4, CHAR(64+4)),
384
 
(5, CHAR(64+5)),
385
 
(6, CHAR(64+6)),
386
 
(7, CHAR(64+7)),
387
 
(8, CHAR(64+8)),
388
 
(9, CHAR(64+9)),
389
 
(10, CHAR(64+10)),
390
 
(11, CHAR(64+11)),
391
 
(12, CHAR(64+12)),
392
 
(13, CHAR(64+13)),
393
 
(14, CHAR(64+14)),
394
 
(15, CHAR(64+15)),
395
 
(16, CHAR(64+16)),
396
 
(17, CHAR(64+17)),
397
 
(18, CHAR(64+18)),
398
 
(19, CHAR(64+19)),
399
 
(20, CHAR(64+20)),
400
 
(21, CHAR(64+21)),
401
 
(22, CHAR(64+22)),
402
 
(23, CHAR(64+23)),
403
 
(24, CHAR(64+24)),
404
 
(25, CHAR(64+25)),
405
 
(26, CHAR(64+26));
406
 
insert into t1(uid, name) select uid, name from t2 order by uid;
407
 
delete from t2;
408
 
insert into t2(id, uid, name) select id, uid, name from t1;
409
 
select count(*) from t1;
410
 
count(*)
411
 
1026
412
 
select count(*) from t2;
413
 
count(*)
414
 
1026
415
 
analyze table t1,t2;
416
 
Table   Op      Msg_type        Msg_text
417
 
test.t1 analyze status  OK
418
 
test.t2 analyze status  OK
419
 
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
420
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
421
 
1       SIMPLE  #       range   uid_index       uid_index       4       #       #       Using where
422
 
1       SIMPLE  #       ref     uid_index       uid_index       4       #       #       
423
 
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid > 0;
424
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
425
 
1       SIMPLE  #       range   uid_index       uid_index       4       #       #       Using where
426
 
1       SIMPLE  #       ref     uid_index       uid_index       4       #       #       
427
 
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid != 0;
428
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
429
 
1       SIMPLE  #       range   uid_index       uid_index       4       #       #       Using where
430
 
1       SIMPLE  #       ref     uid_index       uid_index       4       #       #       
431
 
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid != 0;
432
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
433
 
1       SIMPLE  #       range   uid_index       uid_index       4       #       #       Using where
434
 
1       SIMPLE  #       ref     uid_index       uid_index       4       #       #       
435
 
select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
436
 
id      name    uid     id      name    uid
437
 
1001    A       1       1001    A       1
438
 
1002    B       2       1002    B       2
439
 
1003    C       3       1003    C       3
440
 
1004    D       4       1004    D       4
441
 
1005    E       5       1005    E       5
442
 
1006    F       6       1006    F       6
443
 
1007    G       7       1007    G       7
444
 
1008    H       8       1008    H       8
445
 
1009    I       9       1009    I       9
446
 
1010    J       10      1010    J       10
447
 
1011    K       11      1011    K       11
448
 
1012    L       12      1012    L       12
449
 
1013    M       13      1013    M       13
450
 
1014    N       14      1014    N       14
451
 
1015    O       15      1015    O       15
452
 
1016    P       16      1016    P       16
453
 
1017    Q       17      1017    Q       17
454
 
1018    R       18      1018    R       18
455
 
1019    S       19      1019    S       19
456
 
1020    T       20      1020    T       20
457
 
1021    U       21      1021    U       21
458
 
1022    V       22      1022    V       22
459
 
1023    W       23      1023    W       23
460
 
1024    X       24      1024    X       24
461
 
1025    Y       25      1025    Y       25
462
 
1026    Z       26      1026    Z       26
463
 
select * from t1, t2  where t1.uid=t2.uid AND t1.uid != 0;
464
 
id      name    uid     id      name    uid
465
 
1001    A       1       1001    A       1
466
 
1002    B       2       1002    B       2
467
 
1003    C       3       1003    C       3
468
 
1004    D       4       1004    D       4
469
 
1005    E       5       1005    E       5
470
 
1006    F       6       1006    F       6
471
 
1007    G       7       1007    G       7
472
 
1008    H       8       1008    H       8
473
 
1009    I       9       1009    I       9
474
 
1010    J       10      1010    J       10
475
 
1011    K       11      1011    K       11
476
 
1012    L       12      1012    L       12
477
 
1013    M       13      1013    M       13
478
 
1014    N       14      1014    N       14
479
 
1015    O       15      1015    O       15
480
 
1016    P       16      1016    P       16
481
 
1017    Q       17      1017    Q       17
482
 
1018    R       18      1018    R       18
483
 
1019    S       19      1019    S       19
484
 
1020    T       20      1020    T       20
485
 
1021    U       21      1021    U       21
486
 
1022    V       22      1022    V       22
487
 
1023    W       23      1023    W       23
488
 
1024    X       24      1024    X       24
489
 
1025    Y       25      1025    Y       25
490
 
1026    Z       26      1026    Z       26
491
 
drop table t1,t2;
492
 
create table t1 (x bigint unsigned not null);
493
 
insert into t1(x) values (0x0ffffffffffffff0);
494
 
insert into t1(x) values (0x0ffffffffffffff1);
495
 
select * from t1;
496
 
x
497
 
1152921504606846960
498
 
1152921504606846961
499
 
select count(*) from t1 where x>0;
500
 
count(*)
501
 
2
502
 
select count(*) from t1 where x=0;
503
 
count(*)
504
 
0
505
 
select count(*) from t1 where x<0;
506
 
count(*)
507
 
0
508
 
select count(*) from t1 where x < -16;
509
 
count(*)
510
 
1
511
 
select count(*) from t1 where x = -16;
512
 
count(*)
513
 
1
514
 
select count(*) from t1 where x > -16;
515
 
count(*)
516
 
0
517
 
select count(*) from t1 where x = 18446744073709551601;
518
 
count(*)
519
 
0
520
 
create table t2 (x bigint not null);
521
 
insert into t2(x) values (-16);
522
 
insert into t2(x) values (-15);
523
 
select * from t2;
524
 
x
525
 
-16
526
 
-15
527
 
select count(*) from t2 where x>0;
528
 
count(*)
529
 
0
530
 
select count(*) from t2 where x=0;
531
 
count(*)
532
 
0
533
 
select count(*) from t2 where x<0;
534
 
count(*)
535
 
2
536
 
select count(*) from t2 where x < -16;
537
 
count(*)
538
 
0
539
 
select count(*) from t2 where x = -16;
540
 
count(*)
541
 
1
542
 
select count(*) from t2 where x > -16;
543
 
count(*)
544
 
1
545
 
select count(*) from t2 where x = 18446744073709551601;
546
 
count(*)
547
 
0
548
 
drop table t1,t2;
549
 
create table t1 (x bigint not null primary key) engine=innodb;
550
 
insert into t1(x) values (0x0ffffffffffffff0);
551
 
insert into t1(x) values (0x0ffffffffffffff1);
552
 
select * from t1;
553
 
x
554
 
1152921504606846960
555
 
1152921504606846961
556
 
select count(*) from t1 where x>0;
557
 
count(*)
558
 
2
559
 
select count(*) from t1 where x=0;
560
 
count(*)
561
 
0
562
 
select count(*) from t1 where x<0;
563
 
count(*)
564
 
0
565
 
select count(*) from t1 where x < -16;
566
 
count(*)
567
 
0
568
 
select count(*) from t1 where x = -16;
569
 
count(*)
570
 
0
571
 
select count(*) from t1 where x > -16;
572
 
count(*)
573
 
2
574
 
select count(*) from t1 where x = 18446744073709551601;
575
 
count(*)
576
 
0
577
 
drop table t1;
578
 
create table t1 (a bigint unsigned);
579
 
show create table t1;
580
 
Table   Create Table
581
 
t1      CREATE TABLE `t1` (
582
 
  `a` BIGINT UNSIGNED DEFAULT NULL
583
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
584
 
create index t1i on t1(a);
585
 
show create table t1;
586
 
Table   Create Table
587
 
t1      CREATE TABLE `t1` (
588
 
  `a` BIGINT UNSIGNED DEFAULT NULL,
589
 
  KEY `t1i` (`a`)
590
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
591
 
insert into t1 values (9223372036854775807);
592
 
truncate t1;
593
 
insert into t1 select 18446744073709551615;
594
 
insert into t1 select 18446744073709551614;
595
 
explain select * from t1 where a <> -1;
596
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
597
 
1       SIMPLE  t1      index   t1i     t1i     9       NULL    2       Using where; Using index
598
 
select * from t1 where a <> -1;
599
 
a
600
 
-1
601
 
explain select * from t1 where a > -1 or a < -1;
602
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
603
 
1       SIMPLE  t1      index   t1i     t1i     9       NULL    2       Using where; Using index
604
 
select * from t1 where a > -1 or a < -1;
605
 
a
606
 
-2
607
 
explain select * from t1 where a > -1;
608
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
609
 
1       SIMPLE  t1      index   t1i     t1i     9       NULL    2       Using where; Using index
610
 
select * from t1 where a > -1;
611
 
a
612
 
explain select * from t1 where a < -1;
613
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
614
 
1       SIMPLE  t1      index   t1i     t1i     9       NULL    2       Using where; Using index
615
 
select * from t1 where a < -1;
616
 
a
617
 
-2
618
 
drop table t1;
619
 
create table t1 (a char(10), b text, key (a));
620
 
INSERT INTO t1 (a) VALUES
621
 
('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb');
622
 
explain select * from t1 where a='aaa';
623
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
624
 
1       SIMPLE  t1      ref     a       a       43      const   2       Using where
625
 
explain select * from t1 where a=binary 'aaa';
626
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
627
 
1       SIMPLE  t1      range   a       a       43      NULL    2       Using where
628
 
explain select * from t1 where a='aaa' collate utf8_bin;
629
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
630
 
1       SIMPLE  t1      range   a       a       43      NULL    2       Using where
631
 
drop table t1;
632
 
CREATE TABLE t1 (
633
 
`CLIENT` char(3) collate utf8_bin NOT NULL default '000',
634
 
`ARG1` char(3) collate utf8_bin NOT NULL default '',
635
 
`ARG2` char(3) collate utf8_bin NOT NULL default '',
636
 
`FUNCTION` varchar(10) collate utf8_bin NOT NULL default '',
637
 
`FUNCTINT` int NOT NULL default '0',
638
 
KEY `VERI_CLNT~2` (`ARG1`)
639
 
) ENGINE=InnoDB;
640
 
INSERT INTO t1 VALUES ('000',' 0',' 0','Text 001',0), ('000',' 0',' 1','Text 002',0),
641
 
('000',' 1',' 2','Text 003',0), ('000',' 2',' 3','Text 004',0),
642
 
('001',' 3',' 0','Text 017',0);
643
 
SELECT count(*) FROM t1 WHERE CLIENT='000' AND (ARG1 != ' 1' OR ARG1 != ' 2');
644
 
count(*)
645
 
4
646
 
SELECT count(*) FROM t1 WHERE CLIENT='000' AND (ARG1 != ' 2' OR ARG1 != ' 1');
647
 
count(*)
648
 
4
649
 
drop table t1;
650
 
create table t1 (a int);
651
 
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
652
 
CREATE TABLE t2 (
653
 
pk1 int NOT NULL,
654
 
pk2 int NOT NULL,
655
 
pk3 int NOT NULL,
656
 
pk4 int NOT NULL,
657
 
filler char(82),
658
 
PRIMARY KEY (pk1,pk2,pk3,pk4)
659
 
);
660
 
insert into t2 select 1, A.a+10*B.a, 432, 44, 'fillerZ' from t1 A CROSS JOIN t1 B;
661
 
INSERT INTO t2 VALUES (2621, 2635, 0, 0,'filler'), (2621, 2635, 1, 0,'filler'),
662
 
(2621, 2635, 10, 0,'filler'), (2621, 2635, 11, 0,'filler'),
663
 
(2621, 2635, 14, 0,'filler'), (2621, 2635, 1000015, 0,'filler');
664
 
SELECT * FROM t2
665
 
WHERE ((((pk4 =0) AND (pk1 =2621) AND (pk2 =2635)))
666
 
OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635))))
667
 
) AND (pk3 >=1000000);
668
 
pk1     pk2     pk3     pk4     filler
669
 
2621    2635    1000015 0       filler
670
 
drop table t1, t2;
671
 
create table t1(a char(2), key(a(1)));
672
 
insert into t1 values ('x'), ('xx');
673
 
explain select a from t1 where a > 'x';
674
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
675
 
1       SIMPLE  t1      range   a       a       7       NULL    2       Using where
676
 
select a from t1 where a > 'x';
677
 
a
678
 
xx
679
 
drop table t1;
680
 
CREATE TABLE t1 (
681
 
OXID varchar(32) NOT NULL DEFAULT '',
682
 
OXPARENTID varchar(32) NOT NULL DEFAULT 'oxrootid',
683
 
OXLEFT int NOT NULL DEFAULT '0',
684
 
OXRIGHT int NOT NULL DEFAULT '0',
685
 
OXROOTID varchar(32) NOT NULL DEFAULT '',
686
 
PRIMARY KEY  (OXID),
687
 
KEY OXNID (OXID),
688
 
KEY OXLEFT (OXLEFT),
689
 
KEY OXRIGHT (OXRIGHT),
690
 
KEY OXROOTID (OXROOTID)
691
 
);
692
 
INSERT INTO t1 VALUES
693
 
('d8c4177d09f8b11f5.52725521','oxrootid',1,40,'d8c4177d09f8b11f5.52725521'),
694
 
('d8c4177d151affab2.81582770','d8c4177d09f8b11f5.52725521',2,3,
695
 
'd8c4177d09f8b11f5.52725521'),
696
 
('d8c4177d206a333d2.74422679','d8c4177d09f8b11f5.52725521',4,5,
697
 
'd8c4177d09f8b11f5.52725521'),
698
 
('d8c4177d225791924.30714720','d8c4177d09f8b11f5.52725521',6,7,
699
 
'd8c4177d09f8b11f5.52725521'),
700
 
('d8c4177d2380fc201.39666693','d8c4177d09f8b11f5.52725521',8,9,
701
 
'd8c4177d09f8b11f5.52725521'),
702
 
('d8c4177d24ccef970.14957924','d8c4177d09f8b11f5.52725521',10,11,
703
 
'd8c4177d09f8b11f5.52725521');
704
 
EXPLAIN
705
 
SELECT s.oxid FROM t1 v, t1 s 
706
 
WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND
707
 
v.oxrootid ='d8c4177d09f8b11f5.52725521' AND
708
 
s.oxleft > v.oxleft AND s.oxleft < v.oxright;
709
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
710
 
1       SIMPLE  #       ALL     OXLEFT  NULL    NULL    #       #       Range checked for each record (index map: 0x4)
711
 
1       SIMPLE  #       ALL     OXLEFT,OXRIGHT,OXROOTID NULL    NULL    #       #       Using where
712
 
SELECT s.oxid FROM t1 v, t1 s 
713
 
WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND
714
 
v.oxrootid ='d8c4177d09f8b11f5.52725521' AND
715
 
s.oxleft > v.oxleft AND s.oxleft < v.oxright;
716
 
oxid
717
 
d8c4177d151affab2.81582770
718
 
d8c4177d206a333d2.74422679
719
 
d8c4177d225791924.30714720
720
 
d8c4177d2380fc201.39666693
721
 
d8c4177d24ccef970.14957924
722
 
DROP TABLE t1;
723
 
create table t1 (
724
 
c1  char(10), c2  char(10), c3  char(10), c4  char(10),
725
 
c5  char(10), c6  char(10), c7  char(10), c8  char(10),
726
 
c9  char(10), c10 char(10), c11 char(10), c12 char(10),
727
 
c13 char(10), c14 char(10), c15 char(10), c16 char(10),
728
 
index(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,c13,c14,c15,c16)
729
 
);
730
 
insert into t1 (c1) values ('1'),('1'),('1'),('1');
731
 
select * from t1 where
732
 
c1 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
733
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
734
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
735
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
736
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4",
737
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5",
738
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
739
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
740
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
741
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
742
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
743
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
744
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
745
 
and c2 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
746
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
747
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
748
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
749
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4", 
750
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5",
751
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
752
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
753
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
754
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
755
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
756
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
757
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
758
 
and c3 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
759
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
760
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
761
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
762
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4", 
763
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5",
764
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
765
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
766
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
767
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
768
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
769
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
770
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
771
 
and c4 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
772
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
773
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
774
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
775
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4", 
776
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5", 
777
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
778
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
779
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
780
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
781
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
782
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
783
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
784
 
and c5 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
785
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
786
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
787
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
788
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4",
789
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5",
790
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
791
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
792
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
793
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
794
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
795
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
796
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
797
 
and c6 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
798
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
799
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
800
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
801
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4",
802
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5",
803
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
804
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
805
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
806
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
807
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
808
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
809
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
810
 
and c7 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
811
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
812
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
813
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
814
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4", 
815
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5",
816
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
817
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
818
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
819
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
820
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
821
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
822
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
823
 
and c8 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
824
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
825
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
826
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
827
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4", 
828
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5",
829
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
830
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
831
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
832
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
833
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
834
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
835
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
836
 
and c9 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
837
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
838
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
839
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
840
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4", 
841
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5",
842
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
843
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
844
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
845
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
846
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
847
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
848
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC")
849
 
and c10 in ("abcdefgh", "123456789", "qwertyuio", "asddfgh", 
850
 
"abcdefg1", "123456781", "qwertyui1", "asddfg1", 
851
 
"abcdefg2", "123456782", "qwertyui2", "asddfg2", 
852
 
"abcdefg3", "123456783", "qwertyui3", "asddfg3", 
853
 
"abcdefg4", "123456784", "qwertyui4", "asddfg4", 
854
 
"abcdefg5", "123456785", "qwertyui5", "asddfg5",
855
 
"abcdefg6", "123456786", "qwertyui6", "asddfg6",
856
 
"abcdefg7", "123456787", "qwertyui7", "asddfg7",
857
 
"abcdefg8", "123456788", "qwertyui8", "asddfg8",
858
 
"abcdefg9", "123456789", "qwertyui9", "asddfg9",
859
 
"abcdefgA", "12345678A", "qwertyuiA", "asddfgA",
860
 
"abcdefgB", "12345678B", "qwertyuiB", "asddfgB",
861
 
"abcdefgC", "12345678C", "qwertyuiC", "asddfgC");
862
 
c1      c2      c3      c4      c5      c6      c7      c8      c9      c10     c11     c12     c13     c14     c15     c16
863
 
drop table t1;
864
 
End of 4.1 tests
865
 
CREATE TABLE t1 (
866
 
id int NOT NULL auto_increment,
867
 
status varchar(20),
868
 
PRIMARY KEY  (id),
869
 
KEY (status)
870
 
);
871
 
INSERT INTO t1 VALUES
872
 
(1,'B'), (2,'B'), (3,'B'), (4,'B'), (5,'B'), (6,'B'),
873
 
(7,'B'), (8,'B'), (9,'B'), (10,'B'), (11,'B'), (12,'B'),
874
 
(13,'B'), (14,'B'), (15,'B'), (16,'B'), (17,'B'), (18,'B'),
875
 
(19,'B'), (20,'B'), (21,'B'), (22,'B'), (23,'B'), (24,'B'), 
876
 
(25,'A'), (26,'A'), (27,'A'), (28,'A'), (29,'A'), (30,'A'),
877
 
(31,'A'), (32,'A'), (33,'A'), (34,'A'), (35,'A'), (36,'A'),
878
 
(37,'A'), (38,'A'), (39,'A'), (40,'A'), (41,'A'), (42,'A'),
879
 
(43,'A'), (44,'A'), (45,'A'), (46,'A'), (47,'A'), (48,'A'),
880
 
(49,'A'), (50,'A'), (51,'A'), (52,'A'), (53,'C'), (54,'C'),
881
 
(55,'C'), (56,'C'), (57,'C'), (58,'C'), (59,'C'), (60,'C');
882
 
EXPLAIN SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
883
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
884
 
1       SIMPLE  t1      range   status  status  83      NULL    10      Using where; Using index
885
 
EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B');
886
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
887
 
1       SIMPLE  t1      range   status  status  83      NULL    10      Using where; Using index
888
 
SELECT * FROM t1 WHERE status <> 'A' AND status <> 'B';
889
 
id      status
890
 
53      C
891
 
54      C
892
 
55      C
893
 
56      C
894
 
57      C
895
 
58      C
896
 
59      C
897
 
60      C
898
 
SELECT * FROM t1 WHERE status NOT IN ('A','B');
899
 
id      status
900
 
53      C
901
 
54      C
902
 
55      C
903
 
56      C
904
 
57      C
905
 
58      C
906
 
59      C
907
 
60      C
908
 
EXPLAIN SELECT status FROM t1 WHERE status <> 'A' AND status <> 'B';
909
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
910
 
1       SIMPLE  t1      range   status  status  83      NULL    10      Using where; Using index
911
 
EXPLAIN SELECT status FROM t1 WHERE status NOT IN ('A','B');
912
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
913
 
1       SIMPLE  t1      range   status  status  83      NULL    10      Using where; Using index
914
 
EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
915
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
916
 
1       SIMPLE  t1      range   status  status  83      NULL    9       Using where; Using index
917
 
EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B';
918
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
919
 
1       SIMPLE  t1      range   status  status  83      NULL    9       Using where; Using index
920
 
SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
921
 
id      status
922
 
53      C
923
 
54      C
924
 
55      C
925
 
56      C
926
 
57      C
927
 
58      C
928
 
59      C
929
 
60      C
930
 
SELECT * FROM t1 WHERE status < 'A' OR status > 'B';
931
 
id      status
932
 
53      C
933
 
54      C
934
 
55      C
935
 
56      C
936
 
57      C
937
 
58      C
938
 
59      C
939
 
60      C
940
 
DROP TABLE t1;
941
 
CREATE TABLE t1 (name varchar(15) NOT NULL, KEY idx(name));
942
 
INSERT INTO t1 VALUES ('Betty'), ('Anna');
943
 
SELECT * FROM t1;
944
 
name
945
 
Anna
946
 
Betty
947
 
DELETE FROM t1 WHERE name NOT LIKE 'A%a';
948
 
SELECT * FROM t1;
949
 
name
950
 
Anna
951
 
DROP TABLE t1;
952
 
CREATE TABLE t1 (a int, KEY idx(a));
953
 
INSERT INTO t1 VALUES (NULL), (1), (2), (3);
954
 
SELECT * FROM t1;
955
 
a
956
 
NULL
957
 
1
958
 
2
959
 
3
960
 
DELETE FROM t1 WHERE NOT(a <=> 2);
961
 
SELECT * FROM t1;
962
 
a
963
 
2
964
 
DROP TABLE t1;
965
 
create table t3 (a int);
966
 
insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
967
 
create table t1 (a varchar(10), filler char(200), key(a));
968
 
insert into t1 values ('a','');
969
 
insert into t1 values ('a ','');
970
 
insert into t1 values ('a  ', '');
971
 
insert into t1 select concat('a', 1000 + A.a + 10 * (B.a + 10 * C.a)), ''
972
 
  from t3 A CROSS JOIN t3 B CROSS JOIN t3 C;
973
 
create table t2 (a varchar(10), filler char(200), key(a));
974
 
insert into t2 select * from t1;
975
 
explain select * from t1 where a between 'a' and 'a ';
976
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
977
 
1       SIMPLE  #       ref     a       a       43      #       #       Using where
978
 
explain select * from t1 where a = 'a' or a='a ';
979
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
980
 
1       SIMPLE  #       ref     a       a       43      #       #       Using where
981
 
explain select * from t2 where a between 'a' and 'a ';
982
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
983
 
1       SIMPLE  #       ref     a       a       43      #       #       Using where
984
 
explain select * from t2 where a = 'a' or a='a ';
985
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
986
 
1       SIMPLE  #       ref     a       a       43      #       #       Using where
987
 
update t1 set a='b' where a<>'a';
988
 
explain select * from t1 where a not between 'b' and 'b';
989
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
990
 
1       SIMPLE  #       #       #       #       #       #       #       Using where
991
 
select a, hex(filler) from t1 where a not between 'b' and 'b';
992
 
a       hex(filler)
993
 
a       
994
 
a       
995
 
a       
996
 
drop table t1,t2,t3;
997
 
CREATE TABLE t1 (
998
 
id int NOT NULL DEFAULT '0',
999
 
b int NOT NULL DEFAULT '0',
1000
 
c int NOT NULL DEFAULT '0', 
1001
 
INDEX idx1(b,c), INDEX idx2(c));
1002
 
INSERT INTO t1(id) VALUES (1), (2), (3), (4), (5), (6), (7), (8);
1003
 
INSERT INTO t1(b,c) VALUES (3,4), (3,4);
1004
 
SELECT * FROM t1 WHERE b<=3 AND 3<=c;
1005
 
id      b       c
1006
 
0       3       4
1007
 
0       3       4
1008
 
SELECT * FROM t1 WHERE 3 BETWEEN b AND c;
1009
 
id      b       c
1010
 
0       3       4
1011
 
0       3       4
1012
 
EXPLAIN  SELECT * FROM t1 WHERE b<=3 AND 3<=c;
1013
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1014
 
1       SIMPLE  t1      range   idx1,idx2       idx2    4       NULL    2       Using where
1015
 
EXPLAIN  SELECT * FROM t1 WHERE 3 BETWEEN b AND c;
1016
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1017
 
1       SIMPLE  t1      range   idx1,idx2       idx2    4       NULL    2       Using where
1018
 
SELECT * FROM t1 WHERE 0 < b OR 0 > c;
1019
 
id      b       c
1020
 
0       3       4
1021
 
0       3       4
1022
 
SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c;
1023
 
id      b       c
1024
 
0       3       4
1025
 
0       3       4
1026
 
EXPLAIN SELECT * FROM t1 WHERE 0 < b OR 0 > c;
1027
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1028
 
1       SIMPLE  t1      ALL     idx1,idx2       NULL    NULL    NULL    10      Using where
1029
 
EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c;
1030
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1031
 
1       SIMPLE  t1      ALL     idx1,idx2       NULL    NULL    NULL    10      Using where
1032
 
DROP TABLE t1;
1033
 
CREATE TEMPORARY TABLE t1 (                                      
1034
 
item char(20) NOT NULL default '',                          
1035
 
started datetime, 
1036
 
price decimal(16,3) NOT NULL default '0.000',                 
1037
 
PRIMARY KEY (item,started)                     
1038
 
) ENGINE=MyISAM;
1039
 
INSERT INTO t1 VALUES
1040
 
('A1','2005-11-01 08:00:00',1000),
1041
 
('A1','2005-11-15 00:00:00',2000),
1042
 
('A1','2005-12-12 08:00:00',3000),
1043
 
('A2','2005-12-01 08:00:00',1000);
1044
 
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
1045
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1046
 
1       SIMPLE  #       range   PRIMARY PRIMARY 90      #       #       Using where
1047
 
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
1048
 
item    started price
1049
 
A1      2005-11-01 08:00:00     1000.000
1050
 
A1      2005-11-15 00:00:00     2000.000
1051
 
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
1052
 
item    started price
1053
 
A1      2005-11-01 08:00:00     1000.000
1054
 
A1      2005-11-15 00:00:00     2000.000
1055
 
DROP TABLE t1;
1056
 
 
1057
 
BUG#32198 "Comparison of DATE with DATETIME still not using indexes correctly"
1058
 
 
1059
 
CREATE TABLE t1 (
1060
 
id int NOT NULL auto_increment,
1061
 
dateval date default NULL,
1062
 
PRIMARY KEY  (id),
1063
 
KEY dateval (dateval)
1064
 
) AUTO_INCREMENT=173;
1065
 
INSERT INTO t1 VALUES
1066
 
(1,'2007-01-01'),(2,'2007-01-02'),(3,'2007-01-03'),(4,'2007-01-04'),
1067
 
(5,'2007-01-05'),(6,'2007-01-06'),(7,'2007-01-07'),(8,'2007-01-08'),
1068
 
(9,'2007-01-09'),(10,'2007-01-10'),(11,'2007-01-11');
1069
 
This must use range access:
1070
 
explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59';
1071
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1072
 
1       SIMPLE  t1      index   dateval PRIMARY 4       NULL    11      Using where
1073
 
drop table t1;
1074
 
CREATE TABLE t1 (
1075
 
a varchar(32), index (a)
1076
 
) DEFAULT COLLATE=utf8_bin;
1077
 
INSERT INTO t1 VALUES
1078
 
('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A');
1079
 
SELECT a FROM t1 WHERE a='b' OR a='B';
1080
 
a
1081
 
B
1082
 
B
1083
 
EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
1084
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1085
 
1       SIMPLE  t1      range   a       a       131     NULL    3       Using where; Using index
1086
 
DROP TABLE t1;
1087
 
CREATE TABLE t1 (f1 int NOT NULL, PRIMARY KEY (f1));
1088
 
INSERT INTO t1 VALUES (127),(254),(0),(1),(255);
1089
 
SELECT COUNT(*) FROM t1 WHERE f1 < 256;
1090
 
COUNT(*)
1091
 
5
1092
 
SELECT COUNT(*) FROM t1 WHERE f1 < 256.0;
1093
 
COUNT(*)
1094
 
5
1095
 
SELECT COUNT(*) FROM t1 WHERE f1 < 255;
1096
 
COUNT(*)
1097
 
4
1098
 
SELECT COUNT(*) FROM t1 WHERE f1 < -1;
1099
 
COUNT(*)
1100
 
0
1101
 
SELECT COUNT(*) FROM t1 WHERE f1 > -1;
1102
 
COUNT(*)
1103
 
5
1104
 
DROP TABLE t1;
1105
 
CREATE TABLE t1 ( f1 int NOT NULL, PRIMARY KEY (f1));
1106
 
INSERT INTO t1 VALUES (127),(126),(0),(-128),(-127);
1107
 
SELECT COUNT(*) FROM t1 WHERE f1 < 128;
1108
 
COUNT(*)
1109
 
5
1110
 
SELECT COUNT(*) FROM t1 WHERE f1 < 128.0;
1111
 
COUNT(*)
1112
 
5
1113
 
SELECT COUNT(*) FROM t1 WHERE f1 < 127;
1114
 
COUNT(*)
1115
 
4
1116
 
SELECT COUNT(*) FROM t1 WHERE f1 > -129;
1117
 
COUNT(*)
1118
 
5
1119
 
SELECT COUNT(*) FROM t1 WHERE f1 > -129.0;
1120
 
COUNT(*)
1121
 
5
1122
 
SELECT COUNT(*) FROM t1 WHERE f1 > -128;
1123
 
COUNT(*)
1124
 
4
1125
 
DROP TABLE t1;
1126
 
create table t1 (a int);
1127
 
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
1128
 
create table t2 (a int, b int, filler char(100));
1129
 
insert into t2 select A.a + 10 * (B.a + 10 * C.a), 10, 'filler' from t1 A,
1130
 
t1 B, t1 C where A.a < 5;
1131
 
insert into t2 select 1000, b, 'filler' from t2;
1132
 
alter table t2 add index (a,b);
1133
 
select 'In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)' Z;
1134
 
Z
1135
 
In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)
1136
 
create temporary table t2e like t2;
1137
 
alter table t2e engine=myisam;
1138
 
insert into t2e select * from t2;
1139
 
analyze table t2e;
1140
 
Table   Op      Msg_type        Msg_text
1141
 
test.t2e        analyze note    The storage engine for the table doesn't support analyze
1142
 
explain select * from t2e where a=1000 and b<11;
1143
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1144
 
1       SIMPLE  t2e     ref     a       a       5       const   11      Using where
1145
 
drop table t1, t2;
1146
 
End of 5.1 tests
1147
 
CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1));
1148
 
INSERT INTO t1 VALUES (1),(2),(3);
1149
 
SELECT c1 FROM t1 WHERE c1 >= 'A' GROUP BY 1;
1150
 
c1
1151
 
1
1152
 
2
1153
 
3
1154
 
Warnings:
1155
 
Warning 1366    Incorrect decimal value: 'A' for column 'c1' at row 1
1156
 
Warning 1292    Truncated incorrect DOUBLE value: 'A'
1157
 
Warning 1292    Truncated incorrect DOUBLE value: 'A'
1158
 
Warning 1292    Truncated incorrect DOUBLE value: 'A'
1159
 
DROP TABLE t1;
1160
 
create table t1 (a int,b int,key (b),key (a),key (b,a));
1161
 
insert into t1(a,b) values (1,2),(3,4),(5,6),(7,8);
1162
 
create table t2 (c int);
1163
 
insert into t2(c) values (1),(5),(6),(7),(8);
1164
 
select 1 from (select c from t1,t2 where b >= 1 and a <=> c group by 1 limit 1) as d1;
1165
 
1
1166
 
1
1167
 
drop table t1, t2;