~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
drop table if exists t1;
2
select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3));
3
(1,2,3) IN ((3,2,3), (1,2,3), (1,3,3))
4
1
5
select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
6
row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3))
7
0
8
select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
9
row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3))
10
1
11
select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
12
row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3))
13
0
14
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
15
row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'))
16
1
17
Warnings:
18
Warning	1292	Truncated incorrect DECIMAL value: 'a'
19
Warning	1292	Truncated incorrect INTEGER value: 'a'
20
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
21
row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3))
22
1
23
Warnings:
24
Warning	1292	Truncated incorrect INTEGER value: 'a'
25
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
26
row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3))
27
1
28
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
29
row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3))
30
1
31
select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
32
row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3))
33
0
34
select row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3));
35
row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3))
36
NULL
37
select row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3));
38
row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3))
39
0
40
select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4)));
41
(1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4)))
42
1
43
select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4));
44
ERROR 21000: Operand should contain 2 column(s)
45
select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
46
row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))
47
NULL
48
explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)));
49
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
50
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
51
Warnings:
52
Note	1003	select ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))`
53
SELECT (1,2,3)=(0,NULL,3);
54
(1,2,3)=(0,NULL,3)
55
0
56
SELECT (1,2,3)=(1,NULL,3);
57
(1,2,3)=(1,NULL,3)
58
NULL
59
SELECT (1,2,3)=(1,NULL,0);
60
(1,2,3)=(1,NULL,0)
61
0
62
SELECT ROW(1,2,3)=ROW(1,2,3);
63
ROW(1,2,3)=ROW(1,2,3)
64
1
65
SELECT ROW(2,2,3)=ROW(1+1,2,3);
66
ROW(2,2,3)=ROW(1+1,2,3)
67
1
68
SELECT ROW(1,2,3)=ROW(1+1,2,3);
69
ROW(1,2,3)=ROW(1+1,2,3)
70
0
71
SELECT ROW(1,2,3)<ROW(1+1,2,3);
72
ROW(1,2,3)<ROW(1+1,2,3)
73
1
74
SELECT ROW(1,2,3)>ROW(1+1,2,3);
75
ROW(1,2,3)>ROW(1+1,2,3)
76
0
77
SELECT ROW(1,2,3)<=ROW(1+1,2,3);
78
ROW(1,2,3)<=ROW(1+1,2,3)
79
1
80
SELECT ROW(1,2,3)>=ROW(1+1,2,3);
81
ROW(1,2,3)>=ROW(1+1,2,3)
82
0
83
SELECT ROW(1,2,3)<>ROW(1+1,2,3);
84
ROW(1,2,3)<>ROW(1+1,2,3)
85
1
86
SELECT ROW(NULL,2,3)=ROW(NULL,2,3);
87
ROW(NULL,2,3)=ROW(NULL,2,3)
88
NULL
89
SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3);
90
ROW(NULL,2,3)<=>ROW(NULL,2,3)
91
1
92
SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5));
93
ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5))
94
1
95
SELECT ROW('test',2,3.33)=ROW('test',2,3.33);
96
ROW('test',2,3.33)=ROW('test',2,3.33)
97
1
98
SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4);
99
ERROR 21000: Operand should contain 3 column(s)
100
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33));
101
ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33))
102
1
103
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3));
104
ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3))
105
0
106
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL));
107
ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL))
108
NULL
109
SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4);
110
ERROR 21000: Operand should contain 2 column(s)
111
create table t1 ( a int, b int, c int);
112
insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL);
113
select * from t1 where ROW(1,2,3)=ROW(a,b,c);
114
a	b	c
115
1	2	3
116
select * from t1 where ROW(0,2,3)=ROW(a,b,c);
117
a	b	c
118
select * from t1 where ROW(1,2,3)<ROW(a,b,c);
119
a	b	c
120
2	3	1
121
3	2	1
122
select ROW(a,2,3) IN(row(1,b,c), row(2,3,1)) from t1;
123
ROW(a,2,3) IN(row(1,b,c), row(2,3,1))
124
1
125
0
126
0
127
NULL
128
select ROW(c,2,3) IN(row(1,b,a), row(2,3,1)) from t1;
129
ROW(c,2,3) IN(row(1,b,a), row(2,3,1))
130
0
131
0
132
1
133
NULL
134
select ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) from t1;
135
ROW(a,b,c) IN(row(1,2,3), row(3,2,1))
136
1
137
0
138
1
139
NULL
140
select ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) from t1;
141
ROW(1,2,3) IN(row(a,b,c), row(1,2,3))
142
1
143
1
144
1
145
1
146
drop table t1;
147
select ROW(1,1);
148
ERROR 21000: Operand should contain 1 column(s)
149
create table t1 (i int);
150
select 1 from t1 where ROW(1,1);
151
ERROR 21000: Operand should contain 1 column(s)
152
select count(*) from t1 order by ROW(1,1);
153
ERROR 21000: Operand should contain 1 column(s)
154
select count(*) from t1 having (1,1) order by i;
155
ERROR 21000: Operand should contain 1 column(s)
156
drop table t1;
157
create table t1 (a int, b int);
158
insert into t1 values (1, 4);
159
insert into t1 values (10, 40);
160
insert into t1 values (1, 4);
161
insert into t1 values (10, 43);
162
insert into t1 values (1, 4);
163
insert into t1 values (10, 41);
164
insert into t1 values (1, 4);
165
insert into t1 values (10, 43);
166
insert into t1 values (1, 4);
167
select a, MAX(b), (1, MAX(b)) = (1, 4) from t1 group by a;
168
a	MAX(b)	(1, MAX(b)) = (1, 4)
169
1	4	1
170
10	43	0
171
drop table t1;
172
SELECT ROW(2,10) <=> ROW(3,4);
173
ROW(2,10) <=> ROW(3,4)
174
0
175
SELECT ROW(NULL,10) <=> ROW(3,NULL);
176
ROW(NULL,10) <=> ROW(3,NULL)
177
0
178
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1));
179
ERROR 21000: Operand should contain 2 column(s)
180
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,1),ROW(1,ROW(2,3)));
181
ERROR 21000: Operand should contain 2 column(s)
182
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),ROW(1,ROW(2,2,2)));
183
ERROR 21000: Operand should contain 2 column(s)
184
SELECT ROW(1,ROW(2,3,4)) IN (ROW(1,ROW(2,3,4)),ROW(1,ROW(2,2)));
185
ERROR 21000: Operand should contain 3 column(s)
186
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1));
187
ERROR 21000: Operand should contain 2 column(s)
188
SELECT ROW(1,ROW(2,3)) IN (ROW(1,ROW(2,3)),(SELECT 1,1),ROW(1,ROW(2,4)));
189
ERROR 21000: Operand should contain 2 column(s)
190
SELECT ROW(1,ROW(2,3)) IN ((SELECT 1,1),ROW(1,ROW(2,3)));
191
ERROR 21000: Operand should contain 2 column(s)
192
SELECT ROW(2,1) IN (ROW(21,2),ROW(ROW(1,1,3),0));
193
ERROR 21000: Operand should contain 1 column(s)
194
SELECT ROW(2,1) IN (ROW(ROW(1,1,3),0),ROW(21,2));
195
ERROR 21000: Operand should contain 1 column(s)
196
CREATE TABLE t1(a int, b int, c int);
197
INSERT INTO t1 VALUES (1, 2, 3),
198
(NULL, 2, 3  ), (1, NULL, 3  ), (1, 2,   NULL),
199
(NULL, 2, 3+1), (1, NULL, 3+1), (1, 2+1, NULL),
200
(NULL, 2, 3-1), (1, NULL, 3-1), (1, 2-1, NULL);
201
SELECT (1,2,3) = (1,   NULL, 3);
202
(1,2,3) = (1,   NULL, 3)
203
NULL
204
SELECT (1,2,3) = (1+1, NULL, 3);
205
(1,2,3) = (1+1, NULL, 3)
206
0
207
SELECT (1,2,3) = (1,   NULL, 3+1);
208
(1,2,3) = (1,   NULL, 3+1)
209
0
210
SELECT * FROM t1 WHERE (a,b,c) = (1,2,3);
211
a	b	c
212
1	2	3
213
SELECT (1,2,3) <> (1,   NULL, 3);
214
(1,2,3) <> (1,   NULL, 3)
215
NULL
216
SELECT (1,2,3) <> (1+1, NULL, 3);
217
(1,2,3) <> (1+1, NULL, 3)
218
1
219
SELECT (1,2,3) <> (1,   NULL, 3+1);
220
(1,2,3) <> (1,   NULL, 3+1)
221
1
222
SELECT * FROM t1 WHERE (a,b,c) <> (1,2,3);
223
a	b	c
224
NULL	2	4
225
1	NULL	4
226
1	3	NULL
227
NULL	2	2
228
1	NULL	2
229
1	1	NULL
230
SELECT (1,2,3) < (NULL, 2,    3);
231
(1,2,3) < (NULL, 2,    3)
232
NULL
233
SELECT (1,2,3) < (1,    NULL, 3);
234
(1,2,3) < (1,    NULL, 3)
235
NULL
236
SELECT (1,2,3) < (1-1,  NULL, 3);
237
(1,2,3) < (1-1,  NULL, 3)
238
0
239
SELECT (1,2,3) < (1+1,  NULL, 3);
240
(1,2,3) < (1+1,  NULL, 3)
241
1
242
SELECT * FROM t1 WHERE (a,b,c) < (1,2,3);
243
a	b	c
244
1	1	NULL
245
SELECT (1,2,3) <= (NULL, 2,    3);
246
(1,2,3) <= (NULL, 2,    3)
247
NULL
248
SELECT (1,2,3) <= (1,    NULL, 3);
249
(1,2,3) <= (1,    NULL, 3)
250
NULL
251
SELECT (1,2,3) <= (1-1,  NULL, 3);
252
(1,2,3) <= (1-1,  NULL, 3)
253
0
254
SELECT (1,2,3) <= (1+1,  NULL, 3);
255
(1,2,3) <= (1+1,  NULL, 3)
256
1
257
SELECT * FROM t1 WHERE (a,b,c) <= (1,2,3);
258
a	b	c
259
1	2	3
260
1	1	NULL
261
SELECT (1,2,3) > (NULL, 2,    3);
262
(1,2,3) > (NULL, 2,    3)
263
NULL
264
SELECT (1,2,3) > (1,    NULL, 3);
265
(1,2,3) > (1,    NULL, 3)
266
NULL
267
SELECT (1,2,3) > (1-1,  NULL, 3);
268
(1,2,3) > (1-1,  NULL, 3)
269
1
270
SELECT (1,2,3) > (1+1,  NULL, 3);
271
(1,2,3) > (1+1,  NULL, 3)
272
0
273
SELECT * FROM t1 WHERE (a,b,c) > (1,2,3);
274
a	b	c
275
1	3	NULL
276
SELECT (1,2,3) >= (NULL, 2,    3);
277
(1,2,3) >= (NULL, 2,    3)
278
NULL
279
SELECT (1,2,3) >= (1,    NULL, 3);
280
(1,2,3) >= (1,    NULL, 3)
281
NULL
282
SELECT (1,2,3) >= (1-1,  NULL, 3);
283
(1,2,3) >= (1-1,  NULL, 3)
284
1
285
SELECT (1,2,3) >= (1+1,  NULL, 3);
286
(1,2,3) >= (1+1,  NULL, 3)
287
0
288
SELECT * FROM t1 WHERE (a,b,c) >= (1,2,3);
289
a	b	c
290
1	2	3
291
1	3	NULL
292
DROP TABLE t1;
293
SELECT ROW(1,1,1) = ROW(1,1,1) as `1`, ROW(1,1,1) = ROW(1,2,1) as `0`, ROW(1,NULL,1) = ROW(2,2,1) as `0`, ROW(1,NULL,1) = ROW(1,2,2) as `0`, ROW(1,NULL,1) = ROW(1,2,1) as `null` ;
294
1	0	0	0	null
295
1	0	0	0	NULL
296
select row(NULL,1)=(2,0);
297
row(NULL,1)=(2,0)
298
0
299
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b));
300
INSERT INTO t1 VALUES (1,1), (2,1), (3,1), (1,2), (3,2), (3,3);
301
EXPLAIN SELECT * FROM t1 WHERE a=3 AND b=2;
302
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
303
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	Using index
304
EXPLAIN SELECT * FROM t1 WHERE (a,b)=(3,2);
305
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
306
1	SIMPLE	t1	const	PRIMARY	PRIMARY	8	const,const	1	Using index
307
SELECT * FROM t1 WHERE a=3 and b=2;
308
a	b
309
3	2
310
SELECT * FROM t1 WHERE (a,b)=(3,2);
311
a	b
312
3	2
313
CREATE TABLE t2 (a int, b int, c int, PRIMARY KEY (a,b,c));
314
INSERT INTO t2 VALUES
315
(1,1,2), (3,1,3), (1,2,2), (4,4,2),
316
(1,1,1), (3,1,1), (1,2,1);
317
EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b=t2.b;
318
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
319
1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using index
320
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	Using index
321
EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b);
322
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
323
1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using index
324
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	8	test.t1.a,test.t1.b	1	Using index
325
SELECT * FROM t1,t2 WHERE t1.a=t2.a and t1.b=t2.b;
326
a	b	a	b	c
327
1	1	1	1	1
328
1	1	1	1	2
329
1	2	1	2	1
330
1	2	1	2	2
331
3	1	3	1	1
332
3	1	3	1	3
333
SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b);
334
a	b	a	b	c
335
1	1	1	1	1
336
1	1	1	1	2
337
1	2	1	2	1
338
1	2	1	2	2
339
3	1	3	1	1
340
3	1	3	1	3
341
EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b=2;
342
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
343
1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using where; Using index
344
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.a	1	Using index
345
EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,2);
346
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
347
1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using where; Using index
348
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.a	1	Using index
349
SELECT * FROM t1,t2 WHERE t1.a=1 and t1.b=t2.b;
350
a	b	a	b	c
520.1.10 by Brian Aker
Adding back more tests.
351
1	1	1	1	1
1 by brian
clean slate
352
1	1	1	1	2
520.1.10 by Brian Aker
Adding back more tests.
353
1	2	1	2	1
354
1	2	1	2	2
355
1	1	3	1	1
1 by brian
clean slate
356
1	1	3	1	3
357
SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,2);
358
a	b	a	b	c
359
1	2	1	1	1
360
1	2	1	1	2
361
1	2	1	2	1
362
1	2	1	2	2
363
3	2	3	1	1
364
3	2	3	1	3
365
EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1);
366
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
367
1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	100.00	Using index
368
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.a	1	100.00	Using where; Using index
369
Warnings:
370
Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1)))
371
SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1);
372
a	b	a	b	c
373
1	2	1	1	1
374
1	2	1	1	2
375
3	2	3	1	1
376
3	2	3	1	3
377
EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1);
378
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
379
1	SIMPLE	t1	index	NULL	PRIMARY	8	NULL	6	100.00	Using index
380
1	SIMPLE	t2	index	NULL	PRIMARY	12	NULL	7	100.00	Using where; Using index; Using join buffer
381
Warnings:
382
Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t1`.`a` - 1) = (`test`.`t2`.`a` - 1)) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1)))
383
SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1);
384
a	b	a	b	c
520.1.10 by Brian Aker
Adding back more tests.
385
1	2	1	1	1
1 by brian
clean slate
386
1	2	1	1	2
520.1.10 by Brian Aker
Adding back more tests.
387
3	2	3	1	1
1 by brian
clean slate
388
3	2	3	1	3
389
EXPLAIN SELECT * FROM t2 WHERE a=3 AND b=2;
390
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
391
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	8	const,const	1	Using index
392
EXPLAIN SELECT * FROM t2 WHERE (a,b)=(3,2);
393
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
394
1	SIMPLE	t2	ref	PRIMARY	PRIMARY	8	const,const	1	Using index
395
SELECT * FROM t2 WHERE a=3 and b=2;
396
a	b	c
397
SELECT * FROM t2 WHERE (a,b)=(3,2);
398
a	b	c
399
EXPLAIN SELECT * FROM t1,t2 WHERE t2.a=t1.a AND t2.b=2 AND t2.c=1;
400
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
401
1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using index
402
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	12	test.t1.a,const,const	1	Using index
403
EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
404
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
405
1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	100.00	Using index
406
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	12	test.t1.a,const,const	1	100.00	Using index
407
Warnings:
408
Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
409
SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
410
a	b	a	b	c
411
1	1	1	2	1
412
1	2	1	2	1
413
EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
414
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
415
1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	100.00	Using index
416
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	12	test.t1.a,const,const	1	100.00	Using index
417
Warnings:
418
Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
419
SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
420
a	b	a	b	c
421
1	1	1	2	1
422
1	2	1	2	1
423
DROP TABLE t1,t2;
424
CREATE TABLE t1(
425
a int, b int, c int, d int, e int, f int, g int, h int,
426
PRIMARY KEY (a,b,c,d,e,f,g)
427
);
428
INSERT INTO t1 VALUES (1,2,3,4,5,6,7,99);
429
SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7);
430
h
431
99
432
SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7));
433
SELECT @x;
434
@x
435
99
436
DROP TABLE t1;
437
CREATE TABLE t1 (a INT, b INT);
438
INSERT INTO t1 VALUES (1,1);
439
SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
440
ROW(a, 1) IN (SELECT SUM(b), 1)
441
1
442
SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
443
ROW(a, 1) IN (SELECT SUM(b), 3)
444
0
445
DROP TABLE t1;