~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/func_in.result

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
drop table if exists t1, t2;
2
 
select 1 in (1,2,3);
3
 
1 in (1,2,3)
4
 
1
5
 
select 10 in (1,2,3);
6
 
10 in (1,2,3)
7
 
0
8
 
select NULL in (1,2,3);
9
 
NULL in (1,2,3)
10
 
NULL
11
 
select 1 in (1,NULL,3);
12
 
1 in (1,NULL,3)
13
 
1
14
 
select 3 in (1,NULL,3);
15
 
3 in (1,NULL,3)
16
 
1
17
 
select 10 in (1,NULL,3);
18
 
10 in (1,NULL,3)
19
 
NULL
20
 
select 1.5 in (1.5,2.5,3.5);
21
 
1.5 in (1.5,2.5,3.5)
22
 
1
23
 
select 10.5 in (1.5,2.5,3.5);
24
 
10.5 in (1.5,2.5,3.5)
25
 
0
26
 
select NULL in (1.5,2.5,3.5);
27
 
NULL in (1.5,2.5,3.5)
28
 
NULL
29
 
select 1.5 in (1.5,NULL,3.5);
30
 
1.5 in (1.5,NULL,3.5)
31
 
1
32
 
select 3.5 in (1.5,NULL,3.5);
33
 
3.5 in (1.5,NULL,3.5)
34
 
1
35
 
select 10.5 in (1.5,NULL,3.5);
36
 
10.5 in (1.5,NULL,3.5)
37
 
NULL
38
 
CREATE TABLE t1 (a int, b int, c int);
39
 
insert into t1 values (1,2,3), (1,NULL,3);
40
 
select 1 in (a,b,c) from t1;
41
 
1 in (a,b,c)
42
 
1
43
 
1
44
 
select 3 in (a,b,c) from t1;
45
 
3 in (a,b,c)
46
 
1
47
 
1
48
 
select 10 in (a,b,c) from t1;
49
 
10 in (a,b,c)
50
 
0
51
 
NULL
52
 
select NULL in (a,b,c) from t1;
53
 
NULL in (a,b,c)
54
 
NULL
55
 
NULL
56
 
drop table t1;
57
 
CREATE TABLE t1 (a float, b float, c float);
58
 
insert into t1 values (1.5,2.5,3.5), (1.5,NULL,3.5);
59
 
select 1.5 in (a,b,c) from t1;
60
 
1.5 in (a,b,c)
61
 
1
62
 
1
63
 
select 3.5 in (a,b,c) from t1;
64
 
3.5 in (a,b,c)
65
 
1
66
 
1
67
 
select 10.5 in (a,b,c) from t1;
68
 
10.5 in (a,b,c)
69
 
0
70
 
NULL
71
 
drop table t1;
72
 
CREATE TABLE t1 (a varchar(10), b varchar(10), c varchar(10));
73
 
insert into t1 values ('A','BC','EFD'), ('A',NULL,'EFD');
74
 
select 'A' in (a,b,c) from t1;
75
 
'A' in (a,b,c)
76
 
1
77
 
1
78
 
select 'EFD' in (a,b,c) from t1;
79
 
'EFD' in (a,b,c)
80
 
1
81
 
1
82
 
select 'XSFGGHF' in (a,b,c) from t1;
83
 
'XSFGGHF' in (a,b,c)
84
 
0
85
 
NULL
86
 
drop table t1;
87
 
CREATE TABLE t1 (field char(1));
88
 
INSERT INTO t1 VALUES ('A'),(NULL);
89
 
SELECT * from t1 WHERE field IN (NULL);
90
 
field
91
 
SELECT * from t1 WHERE field NOT IN (NULL);
92
 
field
93
 
SELECT * from t1 where field = field;
94
 
field
95
 
A
96
 
SELECT * from t1 where field <=> field;
97
 
field
98
 
A
99
 
NULL
100
 
DELETE FROM t1 WHERE field NOT IN (NULL);
101
 
SELECT * FROM t1;
102
 
field
103
 
A
104
 
NULL
105
 
drop table t1;
106
 
create table t1 (id int primary key);
107
 
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
108
 
select * from t1 where id in (2,5,9);
109
 
id
110
 
2
111
 
5
112
 
9
113
 
drop table t1;
114
 
create table t1 (
115
 
a char(1),
116
 
b char(1),
117
 
c char(1)
118
 
);
119
 
insert into t1 values ('A','B','C');
120
 
insert into t1 values ('a','c','c');
121
 
select * from t1 where a in (b);
122
 
a       b       c
123
 
select * from t1 where a in (b,c);
124
 
a       b       c
125
 
select * from t1 where 'a' in (a,b,c);
126
 
a       b       c
127
 
A       B       C
128
 
a       c       c
129
 
select * from t1 where 'a' in (a);
130
 
a       b       c
131
 
A       B       C
132
 
a       c       c
133
 
select * from t1 where a in ('a');
134
 
a       b       c
135
 
A       B       C
136
 
a       c       c
137
 
select * from t1 where 'a' collate utf8_general_ci in (a,b,c);
138
 
a       b       c
139
 
A       B       C
140
 
a       c       c
141
 
select * from t1 where 'a' collate utf8_bin in (a,b,c);
142
 
a       b       c
143
 
a       c       c
144
 
select * from t1 where 'a' in (a,b,c collate utf8_bin);
145
 
a       b       c
146
 
a       c       c
147
 
explain extended select * from t1 where 'a' in (a,b,c collate utf8_bin);
148
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    filtered        Extra
149
 
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    2       100.00  Using where
150
 
Warnings:
151
 
Note    1003    select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ('a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate utf8_bin)))
152
 
drop table t1;
153
 
create table t1 (a char(10) not null);
154
 
insert into t1 values ('a'),('b'),('c');
155
 
select a from t1 where a IN ('a','b','c') order by a;
156
 
a
157
 
a
158
 
b
159
 
c
160
 
drop table t1;
161
 
select '1.0' in (1,2);
162
 
'1.0' in (1,2)
163
 
1
164
 
select 1 in ('1.0',2);
165
 
1 in ('1.0',2)
166
 
1
167
 
select 1 in (1,'2.0');
168
 
1 in (1,'2.0')
169
 
1
170
 
select 1 in ('1.0',2.0);
171
 
1 in ('1.0',2.0)
172
 
1
173
 
select 1 in (1.0,'2.0');
174
 
1 in (1.0,'2.0')
175
 
1
176
 
select 1 in ('1.1',2);
177
 
1 in ('1.1',2)
178
 
0
179
 
select 1 in ('1.1',2.0);
180
 
1 in ('1.1',2.0)
181
 
0
182
 
create table t1 (a char(2));
183
 
insert into t1 values ('aa'), ('bb');
184
 
select * from t1 where a in (NULL, 'aa');
185
 
a
186
 
aa
187
 
drop table t1;
188
 
create table t1 (id int, key(id));
189
 
insert into t1 values (1),(2),(3);
190
 
select count(*) from t1 where id not in (1);
191
 
count(*)
192
 
2
193
 
select count(*) from t1 where id not in (1,2);
194
 
count(*)
195
 
1
196
 
drop table t1;
197
 
DROP TABLE IF EXISTS t1;
198
 
CREATE TABLE t1 SELECT 1 IN (2, NULL);
199
 
SELECT should return NULL.
200
 
SELECT * FROM t1;
201
 
1 IN (2, NULL)
202
 
NULL
203
 
DROP TABLE t1;
204
 
End of 4.1 tests
205
 
CREATE TABLE t1 (a int PRIMARY KEY);
206
 
INSERT INTO t1 VALUES (44), (45), (46);
207
 
SELECT * FROM t1 WHERE a IN (45);
208
 
a
209
 
45
210
 
SELECT * FROM t1 WHERE a NOT IN (0, 45);
211
 
a
212
 
44
213
 
46
214
 
SELECT * FROM t1 WHERE a NOT IN (45);
215
 
a
216
 
44
217
 
46
218
 
DROP TABLE t1;
219
 
create table t1 (a int) ENGINE=MYISAM;
220
 
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
221
 
create table t2 (a int, filler char(200), key(a)) ENGINE=MYISAM;
222
 
insert into t2 select C.a*2,   'no'  from t1 A, t1 B, t1 C;
223
 
insert into t2 select C.a*2+1, 'yes' from t1 C;
224
 
explain 
225
 
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
226
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
227
 
1       SIMPLE  t2      range   a       a       5       NULL    12      Using where; Using MRR
228
 
select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
229
 
a       filler
230
 
1       yes
231
 
3       yes
232
 
5       yes
233
 
7       yes
234
 
9       yes
235
 
11      yes
236
 
13      yes
237
 
15      yes
238
 
17      yes
239
 
19      yes
240
 
explain select * from t2 force index(a) where a NOT IN (2,2,2,2,2,2);
241
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
242
 
1       SIMPLE  t2      range   a       a       5       NULL    912     Using where; Using MRR
243
 
explain select * from t2 force index(a) where a <> 2;
244
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
245
 
1       SIMPLE  t2      range   a       a       5       NULL    912     Using where; Using MRR
246
 
drop table t2;
247
 
create table t2 (a datetime, filler char(200), key(a));
248
 
insert into t2 select '2006-04-25 10:00:00' + interval C.a minute,
249
 
'no'  from t1 A, t1 B, t1 C where C.a % 2 = 0;
250
 
insert into t2 select '2006-04-25 10:00:00' + interval C.a*2+1 minute,
251
 
'yes' from t1 C;
252
 
explain 
253
 
select * from t2 where a NOT IN (
254
 
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', 
255
 
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
256
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
257
 
1       SIMPLE  t2      range   a       a       9       NULL    20      Using where; Using MRR
258
 
select * from t2 where a NOT IN (
259
 
'2006-04-25 10:00:00','2006-04-25 10:02:00','2006-04-25 10:04:00', 
260
 
'2006-04-25 10:06:00', '2006-04-25 10:08:00');
261
 
a       filler
262
 
2006-04-25 10:01:00     yes
263
 
2006-04-25 10:03:00     yes
264
 
2006-04-25 10:05:00     yes
265
 
2006-04-25 10:07:00     yes
266
 
2006-04-25 10:09:00     yes
267
 
2006-04-25 10:11:00     yes
268
 
2006-04-25 10:13:00     yes
269
 
2006-04-25 10:15:00     yes
270
 
2006-04-25 10:17:00     yes
271
 
2006-04-25 10:19:00     yes
272
 
drop table t2;
273
 
create table t2 (a varchar(10), filler char(200), key(a));
274
 
insert into t2 select 'foo', 'no' from t1 A, t1 B;
275
 
insert into t2 select 'barbar', 'no' from t1 A, t1 B;
276
 
insert into t2 select 'bazbazbaz', 'no' from t1 A, t1 B;
277
 
insert into t2 values ('fon', '1'), ('fop','1'), ('barbaq','1'), 
278
 
('barbas','1'), ('bazbazbay', '1'),('zz','1');
279
 
explain select * from t2 where a not in('foo','barbar', 'bazbazbaz');
280
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
281
 
1       SIMPLE  t2      range   a       a       43      NULL    5       Using where; Using MRR
282
 
drop table t2;
283
 
create table t2 (a decimal(10,5), filler char(200), key(a));
284
 
insert into t2 select 345.67890, 'no' from t1 A, t1 B;
285
 
insert into t2 select 43245.34, 'no' from t1 A, t1 B;
286
 
insert into t2 select 64224.56344, 'no' from t1 A, t1 B;
287
 
insert into t2 values (0, '1'), (22334.123,'1'), (33333,'1'), 
288
 
(55555,'1'), (77777, '1');
289
 
explain
290
 
select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
291
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
292
 
1       SIMPLE  t2      range   a       a       7       NULL    4       Using where; Using MRR
293
 
select * from t2 where a not in (345.67890, 43245.34, 64224.56344);
294
 
a       filler
295
 
0.00000 1
296
 
22334.12300     1
297
 
33333.00000     1
298
 
55555.00000     1
299
 
77777.00000     1
300
 
drop table t2;
301
 
create table t2 (a int, key(a), b int);
302
 
insert into t2 values (1,1),(2,2);
303
 
set @cnt= 1;
304
 
set @str="update t2 set b=1 where a not in (";
305
 
select count(*) from (
306
 
select @str:=concat(@str, @cnt:=@cnt+1, ",") 
307
 
from t1 A, t1 B, t1 C, t1 D) Z;
308
 
count(*)
309
 
10000
310
 
set @str:=concat(@str, "10000)");
311
 
select substr(@str, 1, 50);
312
 
substr(@str, 1, 50)
313
 
update t2 set b=1 where a not in (2,3,4,5,6,7,8,9,
314
 
set @str=NULL;
315
 
drop table t2;
316
 
drop table t1;
317
 
create table t1 (
318
 
some_id int,
319
 
key (some_id)
320
 
);
321
 
insert into t1 values (1),(2);
322
 
select some_id from t1 where some_id not in(2,-1);
323
 
some_id
324
 
1
325
 
select some_id from t1 where some_id not in(-4,-1,-4);
326
 
some_id
327
 
1
328
 
2
329
 
select some_id from t1 where some_id not in(-4,-1,3423534,2342342);
330
 
some_id
331
 
1
332
 
2
333
 
select some_id from t1 where some_id not in('-1', '0');
334
 
some_id
335
 
1
336
 
2
337
 
drop table t1;
338
 
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a));
339
 
INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1);
340
 
CREATE TABLE t2 (a int, b int, PRIMARY KEY (a));
341
 
INSERT INTO t2 VALUES (3,2),(4,2),(100,100),(101,201),(102,102);
342
 
CREATE TABLE t3 (a int PRIMARY KEY);
343
 
INSERT INTO t3 VALUES (1),(2),(3),(4);
344
 
CREATE TABLE t4 (a int PRIMARY KEY,b int);
345
 
INSERT INTO t4 VALUES (1,1),(2,2),(1000,1000),(1001,1001),(1002,1002),
346
 
(1003,1003),(1004,1004);
347
 
EXPLAIN SELECT STRAIGHT_JOIN * FROM t3 
348
 
JOIN t1 ON t3.a=t1.a 
349
 
JOIN t2 ON t3.a=t2.a
350
 
JOIN t4 WHERE t4.a IN (t1.b, t2.b);
351
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
352
 
1       SIMPLE  t3      index   PRIMARY PRIMARY 4       NULL    4       Using index
353
 
1       SIMPLE  t1      eq_ref  PRIMARY PRIMARY 4       test.t3.a       1       
354
 
1       SIMPLE  t2      ALL     PRIMARY NULL    NULL    NULL    5       Using where; Using join buffer
355
 
1       SIMPLE  t4      ALL     PRIMARY NULL    NULL    NULL    7       Range checked for each record (index map: 0x1)
356
 
SELECT STRAIGHT_JOIN * FROM t3 
357
 
JOIN t1 ON t3.a=t1.a 
358
 
JOIN t2 ON t3.a=t2.a
359
 
JOIN t4 WHERE t4.a IN (t1.b, t2.b);
360
 
a       a       b       a       b       a       b
361
 
3       3       1       3       2       1       1
362
 
3       3       1       3       2       2       2
363
 
4       4       1       4       2       1       1
364
 
4       4       1       4       2       2       2
365
 
EXPLAIN SELECT STRAIGHT_JOIN 
366
 
(SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b)) 
367
 
FROM t3, t1, t2
368
 
WHERE t3.a=t1.a AND t3.a=t2.a;
369
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
370
 
1       PRIMARY t3      index   PRIMARY PRIMARY 4       NULL    4       Using index
371
 
1       PRIMARY t1      eq_ref  PRIMARY PRIMARY 4       test.t3.a       1       
372
 
1       PRIMARY t2      ALL     PRIMARY NULL    NULL    NULL    5       Using where; Using join buffer
373
 
2       DEPENDENT SUBQUERY      t4      index   NULL    PRIMARY 4       NULL    7       Using where; Using index
374
 
SELECT STRAIGHT_JOIN 
375
 
(SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b)) 
376
 
FROM t3, t1, t2
377
 
WHERE t3.a=t1.a AND t3.a=t2.a;
378
 
(SELECT SUM(t4.a) FROM t4 WHERE t4.a IN (t1.b, t2.b))
379
 
3
380
 
3
381
 
DROP TABLE t1,t2,t3,t4;
382
 
CREATE TABLE t1(a BIGINT);
383
 
INSERT INTO t1 VALUES (0x0FFFFFFFFFFFFFFF);
384
 
SELECT * FROM t1 WHERE a=-1 OR a=-2 ;
385
 
a
386
 
SELECT * FROM t1 WHERE a IN (-1, -2);
387
 
a
388
 
CREATE TABLE t2 (a BIGINT);
389
 
insert into t2 values(13491727406643098568),
390
 
(0x0fffffefffffffff),
391
 
(0x0ffffffeffffffff),
392
 
(0x0fffffffefffffff),
393
 
(0x0ffffffffeffffff),
394
 
(0x0fffffffffefffff),
395
 
(0x0ffffffffffeffff),
396
 
(0x0fffffffffffefff),
397
 
(0x0ffffffffffffeff),
398
 
(0x0fffffffffffffef),
399
 
(0x0ffffffffffffffe),
400
 
(0x0fffffffffffffff),
401
 
(0x2000000000000000),
402
 
(0x2000000000000001),
403
 
(0x2000000000000002),
404
 
(0x2000000000000300),
405
 
(0x2000000000000400),
406
 
(0x2000000000000401),
407
 
(0x2000000000004001),
408
 
(0x2000000000040001),
409
 
(0x2000000000400001),
410
 
(0x2000000004000001),
411
 
(0x2000000040000001),
412
 
(0x2000000400000001),
413
 
(0x2000004000000001),
414
 
(0x2000040000000001);
415
 
SELECT HEX(a) FROM t2 WHERE a IN (0xBB3C3E98175D33C8, 42);
416
 
HEX(a)
417
 
SELECT HEX(a) FROM t2 WHERE a IN
418
 
(0xBB3C3E98175D33C8,
419
 
0x2fffffffffffffff,
420
 
0x2000000000000000,
421
 
0x2000000000000400,
422
 
0x2000000000000401,
423
 
42);
424
 
HEX(a)
425
 
2000000000000000
426
 
2000000000000001
427
 
2000000000000002
428
 
2000000000000300
429
 
2000000000000400
430
 
2000000000000401
431
 
SELECT HEX(a) FROM t2 WHERE a IN 
432
 
(0x7fffffffffffffff, 
433
 
0x2000000000000001);
434
 
HEX(a)
435
 
2000000000000001
436
 
SELECT HEX(a) FROM t2 WHERE a IN 
437
 
(0x2ffffffffffffffe, 
438
 
0x2fffffffffffffff);
439
 
HEX(a)
440
 
SELECT HEX(a) FROM t2 WHERE a IN 
441
 
(0x2ffffffffffffffe, 
442
 
0x2fffffffffffffff,
443
 
'abc');
444
 
HEX(a)
445
 
CREATE TABLE t3 (a BIGINT);
446
 
INSERT INTO t3 VALUES (9223372036854775551);
447
 
SELECT HEX(a) FROM t3 WHERE a IN (9223372036854775807, 42);
448
 
HEX(a)
449
 
CREATE TABLE t4 (a DATE);
450
 
INSERT INTO t4 VALUES ('1972-02-06'), ('1972-07-29');
451
 
SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29');
452
 
a
453
 
1972-02-06
454
 
Warnings:
455
 
Warning 1292    Incorrect date value: '19772-07-29' for column 'a' at row 1
456
 
DROP TABLE t1,t2,t3,t4;
457
 
CREATE TABLE t1 (id int not null);
458
 
INSERT INTO t1 VALUES (1),(2);
459
 
SELECT id FROM t1 WHERE id IN(4564, (SELECT IF(1=0,1,1/0)) );
460
 
id
461
 
Warnings:
462
 
Error   1365    Division by 0
463
 
Error   1365    Division by 0
464
 
DROP TABLE t1;
465
 
End of 5.0 tests
466
 
create table t1(f1 char(1)) ENGINE=MYISAM;
467
 
insert into t1 values ('a'),('b'),('1');
468
 
select f1 from t1 where f1 in ('a',1);
469
 
f1
470
 
a
471
 
1
472
 
select f1, case f1 when 'a' then '+' when 1 then '-' end from t1;
473
 
f1      case f1 when 'a' then '+' when 1 then '-' end 
474
 
a       +
475
 
b       NULL
476
 
1       -
477
 
create index t1f1_idx on t1(f1);
478
 
select f1 from t1 where f1 in ('a',1);
479
 
f1
480
 
1
481
 
a
482
 
explain select f1 from t1 where f1 in ('a',1);
483
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
484
 
1       SIMPLE  t1      index   t1f1_idx        t1f1_idx        7       NULL    3       Using where; Using index
485
 
select f1 from t1 where f1 in ('a','b');
486
 
f1
487
 
a
488
 
b
489
 
explain select f1 from t1 where f1 in ('a','b');
490
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
491
 
1       SIMPLE  t1      index   t1f1_idx        t1f1_idx        7       NULL    3       Using where; Using index
492
 
select f1 from t1 where f1 in (2,1);
493
 
f1
494
 
1
495
 
explain select f1 from t1 where f1 in (2,1);
496
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
497
 
1       SIMPLE  t1      index   t1f1_idx        t1f1_idx        7       NULL    3       Using where; Using index
498
 
create table t2(f2 int, index t2f2(f2)) ENGINE=MYISAM;
499
 
insert into t2 values(0),(1),(2);
500
 
select f2 from t2 where f2 in ('a',2);
501
 
f2
502
 
0
503
 
2
504
 
Warnings:
505
 
Warning 1292    Truncated incorrect DOUBLE value: 'a'
506
 
Warning 1292    Truncated incorrect DOUBLE value: 'a'
507
 
Warning 1292    Truncated incorrect DOUBLE value: 'a'
508
 
explain select f2 from t2 where f2 in ('a',2);
509
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
510
 
1       SIMPLE  t2      index   t2f2    t2f2    5       NULL    3       Using where; Using index
511
 
select f2 from t2 where f2 in ('a','b');
512
 
f2
513
 
0
514
 
Warnings:
515
 
Warning 1292    Truncated incorrect DOUBLE value: 'a'
516
 
Warning 1292    Truncated incorrect DOUBLE value: 'b'
517
 
explain select f2 from t2 where f2 in ('a','b');
518
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
519
 
1       SIMPLE  t2      index   t2f2    t2f2    5       NULL    3       Using where; Using index
520
 
Warnings:
521
 
Warning 1292    Truncated incorrect DOUBLE value: 'a'
522
 
Warning 1292    Truncated incorrect DOUBLE value: 'b'
523
 
select f2 from t2 where f2 in (1,'b');
524
 
f2
525
 
0
526
 
1
527
 
Warnings:
528
 
Warning 1292    Truncated incorrect DOUBLE value: 'b'
529
 
Warning 1292    Truncated incorrect DOUBLE value: 'b'
530
 
explain select f2 from t2 where f2 in (1,'b');
531
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
532
 
1       SIMPLE  t2      index   t2f2    t2f2    5       NULL    3       Using where; Using index
533
 
drop table t1, t2;
534
 
create table t1 (a time, key(a));
535
 
insert into t1 values (),(),(),(),(),(),(),(),(),();
536
 
select a from t1 where a not in (a,a,a) group by a;
537
 
a
538
 
drop table t1;
539
 
End of 5.1 tests