~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/r/mix2_myisam.result

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
SET SESSION STORAGE_ENGINE = MEMORY;
2
 
drop table if exists t1,t2,t3,t4;
3
 
drop database if exists mysqltest;
4
 
create TEMPORARY table t1 (id int not null auto_increment, code int not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=MyISAM;
5
 
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
6
 
select id, code, name from t1 order by id;
7
 
id      code    name
8
 
1       1       Tim
9
 
2       1       Monty
10
 
3       2       David
11
 
4       2       Erik
12
 
5       3       Sasha
13
 
6       3       Jeremy
14
 
7       4       Matt
15
 
update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
16
 
select id, code, name from t1 order by id;
17
 
id      code    name
18
 
2       1       Monty
19
 
3       2       David
20
 
4       2       Erik
21
 
5       3       Sasha
22
 
6       3       Jeremy
23
 
7       4       Matt
24
 
8       1       Sinisa
25
 
update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
26
 
select id, code, name from t1 order by id;
27
 
id      code    name
28
 
3       2       David
29
 
4       2       Erik
30
 
5       3       Sasha
31
 
6       3       Jeremy
32
 
7       4       Matt
33
 
8       1       Sinisa
34
 
12      1       Ralph
35
 
drop table t1;
36
 
create TEMPORARY table t1 (
37
 
id int NOT NULL auto_increment,
38
 
parent_id int DEFAULT '0' NOT NULL,
39
 
level int DEFAULT '0' NOT NULL,
40
 
PRIMARY KEY (id),
41
 
KEY parent_id (parent_id),
42
 
KEY level (level)
43
 
) engine=MyISAM;
44
 
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
45
 
update t1 set parent_id=parent_id+100;
46
 
select * from t1 where parent_id=102;
47
 
id      parent_id       level
48
 
8       102     2
49
 
9       102     2
50
 
15      102     2
51
 
update t1 set id=id+1000;
52
 
update t1 set id=1024 where id=1009;
53
 
Got one of the listed errors
54
 
select * from t1;
55
 
id      parent_id       level
56
 
1001    100     0
57
 
1003    101     1
58
 
1004    101     1
59
 
1008    102     2
60
 
1009    102     2
61
 
1017    103     2
62
 
1022    104     2
63
 
1024    104     2
64
 
1028    105     2
65
 
1029    105     2
66
 
1030    105     2
67
 
1031    106     2
68
 
1032    106     2
69
 
1033    106     2
70
 
1203    107     2
71
 
1202    107     2
72
 
1020    103     2
73
 
1157    100     0
74
 
1193    105     2
75
 
1040    107     2
76
 
1002    101     1
77
 
1015    102     2
78
 
1006    101     1
79
 
1034    106     2
80
 
1035    106     2
81
 
1016    103     2
82
 
1007    101     1
83
 
1036    107     2
84
 
1018    103     2
85
 
1026    105     2
86
 
1027    105     2
87
 
1183    104     2
88
 
1038    107     2
89
 
1025    105     2
90
 
1037    107     2
91
 
1021    104     2
92
 
1019    103     2
93
 
1005    101     1
94
 
1179    105     2
95
 
update ignore t1 set id=id+1;
96
 
select * from t1;
97
 
id      parent_id       level
98
 
1001    100     0
99
 
1003    101     1
100
 
1004    101     1
101
 
1008    102     2
102
 
1010    102     2
103
 
1017    103     2
104
 
1023    104     2
105
 
1024    104     2
106
 
1028    105     2
107
 
1029    105     2
108
 
1030    105     2
109
 
1031    106     2
110
 
1032    106     2
111
 
1033    106     2
112
 
1204    107     2
113
 
1203    107     2
114
 
1020    103     2
115
 
1158    100     0
116
 
1194    105     2
117
 
1041    107     2
118
 
1002    101     1
119
 
1015    102     2
120
 
1006    101     1
121
 
1034    106     2
122
 
1035    106     2
123
 
1016    103     2
124
 
1007    101     1
125
 
1036    107     2
126
 
1018    103     2
127
 
1026    105     2
128
 
1027    105     2
129
 
1184    104     2
130
 
1039    107     2
131
 
1025    105     2
132
 
1038    107     2
133
 
1022    104     2
134
 
1019    103     2
135
 
1005    101     1
136
 
1180    105     2
137
 
update ignore t1 set id=1023 where id=1010;
138
 
select * from t1 where parent_id=102;
139
 
id      parent_id       level
140
 
1008    102     2
141
 
1010    102     2
142
 
1015    102     2
143
 
explain select level from t1 where level=1;
144
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
145
 
1       SIMPLE  t1      ref     level   level   4       const   #       Using index
146
 
explain select level,id from t1 where level=1;
147
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
148
 
1       SIMPLE  t1      ref     level   level   4       const   #       
149
 
explain select level,id,parent_id from t1 where level=1;
150
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
151
 
1       SIMPLE  t1      ref     level   level   4       const   #       
152
 
select level,id from t1 where level=1;
153
 
level   id
154
 
1       1003
155
 
1       1004
156
 
1       1002
157
 
1       1006
158
 
1       1007
159
 
1       1005
160
 
select level,id,parent_id from t1 where level=1;
161
 
level   id      parent_id
162
 
1       1003    101
163
 
1       1004    101
164
 
1       1002    101
165
 
1       1006    101
166
 
1       1007    101
167
 
1       1005    101
168
 
alter table t1 engine=MyISAM;
169
 
drop table t1;
170
 
create TEMPORARY table t1 (
171
 
gesuchnr int DEFAULT '0' NOT NULL,
172
 
benutzer_id int DEFAULT '0' NOT NULL,
173
 
PRIMARY KEY (gesuchnr,benutzer_id)
174
 
) engine=MyISAM;
175
 
replace into t1 (gesuchnr,benutzer_id) values (2,1);
176
 
replace into t1 (gesuchnr,benutzer_id) values (1,1);
177
 
replace into t1 (gesuchnr,benutzer_id) values (1,1);
178
 
select * from t1;
179
 
gesuchnr        benutzer_id
180
 
1       1
181
 
2       1
182
 
drop table t1;
183
 
create TEMPORARY table t1 (a int) engine=MyISAM;
184
 
insert into t1 values (1), (2);
185
 
alter table t1 ENGINE=MyISAM;
186
 
delete from t1 where a = 1;
187
 
select * from t1;
188
 
a
189
 
2
190
 
check table t1;
191
 
Table   Op      Msg_type        Msg_text
192
 
test.t1 check   status  OK
193
 
drop table t1;
194
 
create TEMPORARY table t1 (a int,b varchar(20)) engine=MyISAM;
195
 
insert into t1 values (1,""), (2,"testing");
196
 
delete from t1 where a = 1;
197
 
select * from t1;
198
 
a       b
199
 
2       testing
200
 
create index skr on t1 (a);
201
 
insert into t1 values (3,""), (4,"testing");
202
 
analyze table t1;
203
 
Table   Op      Msg_type        Msg_text
204
 
test.t1 analyze note    The storage engine for the table doesn't support analyze
205
 
drop table t1;
206
 
create TEMPORARY table t1 (a int,b varchar(20),key(a)) engine=MyISAM;
207
 
insert into t1 values (1,""), (2,"testing");
208
 
select * from t1 where a = 1;
209
 
a       b
210
 
1       
211
 
drop table t1;
212
 
create TEMPORARY table t1 (
213
 
user_id int DEFAULT '0' NOT NULL,
214
 
name varchar(100),
215
 
phone varchar(100),
216
 
ref_email varchar(100) DEFAULT '' NOT NULL,
217
 
detail varchar(200),
218
 
PRIMARY KEY (user_id,ref_email)
219
 
)engine=MyISAM;
220
 
INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
221
 
select * from t1 where user_id=10292;
222
 
user_id name    phone   ref_email       detail
223
 
10292   sanjeev 29153373        sansh777@hotmail.com    xxx
224
 
10292   shirish 2333604 shirish@yahoo.com       ddsds
225
 
10292   sonali  323232  sonali@bolly.com        filmstar
226
 
INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
227
 
select * from t1 where user_id=10292;
228
 
user_id name    phone   ref_email       detail
229
 
10292   sanjeev 29153373        sansh777@hotmail.com    xxx
230
 
10292   shirish 2333604 shirish@yahoo.com       ddsds
231
 
10292   sonali  323232  sonali@bolly.com        filmstar
232
 
select * from t1 where user_id>=10292;
233
 
user_id name    phone   ref_email       detail
234
 
10292   sanjeev 29153373        sansh777@hotmail.com    xxx
235
 
10292   shirish 2333604 shirish@yahoo.com       ddsds
236
 
10292   sonali  323232  sonali@bolly.com        filmstar
237
 
10293   shirish 2333604 shirish@yahoo.com       ddsds
238
 
select * from t1 where user_id>10292;
239
 
user_id name    phone   ref_email       detail
240
 
10293   shirish 2333604 shirish@yahoo.com       ddsds
241
 
select * from t1 where user_id<10292;
242
 
user_id name    phone   ref_email       detail
243
 
10291   sanjeev 29153373        sansh777@hotmail.com    xxx
244
 
drop table t1;
245
 
create TEMPORARY table t1 (a int not null, b int not null,c int not null,
246
 
key(a),primary key(a,b), unique(c),key(a),unique(b)) ENGINE = MyISAM;
247
 
drop table t1;
248
 
create TEMPORARY table t1 (col1 int not null, col2 char(4) not null, primary key(col1)) ENGINE = MEMORY;
249
 
alter table t1 engine=MyISAM;
250
 
insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
251
 
select * from t1;
252
 
col1    col2
253
 
1       1
254
 
5       2
255
 
2       3
256
 
3       4
257
 
4       4
258
 
update t1 set col2='7' where col1='4';
259
 
select * from t1;
260
 
col1    col2
261
 
1       1
262
 
5       2
263
 
2       3
264
 
3       4
265
 
4       7
266
 
alter table t1 add co3 int not null;
267
 
select * from t1;
268
 
col1    col2    co3
269
 
1       1       0
270
 
5       2       0
271
 
2       3       0
272
 
3       4       0
273
 
4       7       0
274
 
update t1 set col2='9' where col1='2';
275
 
select * from t1;
276
 
col1    col2    co3
277
 
1       1       0
278
 
5       2       0
279
 
2       9       0
280
 
3       4       0
281
 
4       7       0
282
 
drop table t1;
283
 
create TEMPORARY table t1 (a int not null , b int, primary key (a)) engine = MyISAM;
284
 
create TEMPORARY table t2 (a int not null , b int, primary key (a)) engine = MEMORY;
285
 
insert into t1 VALUES (1,3) , (2,3), (3,3);
286
 
select * from t1;
287
 
a       b
288
 
1       3
289
 
2       3
290
 
3       3
291
 
insert into t2 select * from t1;
292
 
select * from t2;
293
 
a       b
294
 
1       3
295
 
2       3
296
 
3       3
297
 
delete from t1 where b = 3;
298
 
select * from t1;
299
 
a       b
300
 
insert into t1 select * from t2;
301
 
select * from t1;
302
 
a       b
303
 
3       3
304
 
2       3
305
 
1       3
306
 
select * from t2;
307
 
a       b
308
 
1       3
309
 
2       3
310
 
3       3
311
 
drop table t1,t2;
312
 
create TEMPORARY table t1 (
313
 
id int NOT NULL auto_increment,
314
 
ggid varchar(32) DEFAULT '' NOT NULL,
315
 
email varchar(64) DEFAULT '' NOT NULL,
316
 
passwd varchar(32) DEFAULT '' NOT NULL,
317
 
PRIMARY KEY (id),
318
 
UNIQUE ggid (ggid)
319
 
) ENGINE=MyISAM;
320
 
insert into t1 (ggid,passwd) values ('test1','xxx');
321
 
insert into t1 (ggid,passwd) values ('test2','yyy');
322
 
insert into t1 (ggid,passwd) values ('test2','this will fail');
323
 
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
324
 
insert into t1 (ggid,id) values ('this will fail',1);
325
 
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
326
 
select * from t1 where ggid='test1';
327
 
id      ggid    email   passwd
328
 
1       test1           xxx
329
 
select * from t1 where passwd='xxx';
330
 
id      ggid    email   passwd
331
 
1       test1           xxx
332
 
select * from t1 where id=2;
333
 
id      ggid    email   passwd
334
 
2       test2           yyy
335
 
replace into t1 (ggid,id) values ('this will work',1);
336
 
replace into t1 (ggid,passwd) values ('test2','this will work');
337
 
update t1 set id=100,ggid='test2' where id=1;
338
 
ERROR 23000: Duplicate entry 'test2' for key 'ggid'
339
 
select * from t1;
340
 
id      ggid    email   passwd
341
 
1       this will work          
342
 
3       test2           this will work
343
 
select * from t1 where id=1;
344
 
id      ggid    email   passwd
345
 
1       this will work          
346
 
select * from t1 where id=999;
347
 
id      ggid    email   passwd
348
 
drop table t1;
349
 
create TEMPORARY table t1 (
350
 
user_name varchar(12),
351
 
password text,
352
 
subscribed char(1),
353
 
user_id int DEFAULT '0' NOT NULL,
354
 
quota bigint,
355
 
weight double,
356
 
access_date date,
357
 
approved datetime,
358
 
dummy_primary_key int NOT NULL auto_increment,
359
 
PRIMARY KEY (dummy_primary_key)
360
 
) ENGINE=MyISAM;
361
 
INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','2000-09-07 23:06:59',1);
362
 
INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','2000-09-07 23:06:59',2);
363
 
INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','2000-09-07 23:06:59',3);
364
 
INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','2000-09-07 23:06:59',4);
365
 
INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','2000-09-07 23:06:59',5);
366
 
select  user_name, password , subscribed, user_id, quota, weight, access_date, approved, dummy_primary_key from t1 order by user_name;
367
 
user_name       password        subscribed      user_id quota   weight  access_date     approved        dummy_primary_key
368
 
user_0  somepassword    N       0       0       0       2000-09-07      2000-09-07 23:06:59     1
369
 
user_1  somepassword    Y       1       1       1       2000-09-07      2000-09-07 23:06:59     2
370
 
user_2  somepassword    N       2       2       1.4142135623731 2000-09-07      2000-09-07 23:06:59     3
371
 
user_3  somepassword    Y       3       3       1.7320508075689 2000-09-07      2000-09-07 23:06:59     4
372
 
user_4  somepassword    N       4       4       2       2000-09-07      2000-09-07 23:06:59     5
373
 
drop table t1;
374
 
create TEMPORARY table t1 (
375
 
id int NOT NULL auto_increment,
376
 
parent_id int DEFAULT '0' NOT NULL,
377
 
level int DEFAULT '0' NOT NULL,
378
 
KEY (id),
379
 
KEY parent_id (parent_id),
380
 
KEY level (level)
381
 
) engine=MyISAM;
382
 
INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
383
 
INSERT INTO t1 values (179,5,2);
384
 
update t1 set parent_id=parent_id+100;
385
 
select * from t1 where parent_id=102;
386
 
id      parent_id       level
387
 
8       102     2
388
 
9       102     2
389
 
15      102     2
390
 
update t1 set id=id+1000;
391
 
update t1 set id=1024 where id=1009;
392
 
select * from t1;
393
 
id      parent_id       level
394
 
1001    100     0
395
 
1003    101     1
396
 
1004    101     1
397
 
1008    102     2
398
 
1024    102     2
399
 
1017    103     2
400
 
1022    104     2
401
 
1024    104     2
402
 
1028    105     2
403
 
1029    105     2
404
 
1030    105     2
405
 
1031    106     2
406
 
1032    106     2
407
 
1033    106     2
408
 
1203    107     2
409
 
1202    107     2
410
 
1020    103     2
411
 
1157    100     0
412
 
1193    105     2
413
 
1040    107     2
414
 
1002    101     1
415
 
1015    102     2
416
 
1006    101     1
417
 
1034    106     2
418
 
1035    106     2
419
 
1016    103     2
420
 
1007    101     1
421
 
1036    107     2
422
 
1018    103     2
423
 
1026    105     2
424
 
1027    105     2
425
 
1183    104     2
426
 
1038    107     2
427
 
1025    105     2
428
 
1037    107     2
429
 
1021    104     2
430
 
1019    103     2
431
 
1005    101     1
432
 
1179    105     2
433
 
update ignore t1 set id=id+1;
434
 
select * from t1;
435
 
id      parent_id       level
436
 
1002    100     0
437
 
1004    101     1
438
 
1005    101     1
439
 
1009    102     2
440
 
1025    102     2
441
 
1018    103     2
442
 
1023    104     2
443
 
1025    104     2
444
 
1029    105     2
445
 
1030    105     2
446
 
1031    105     2
447
 
1032    106     2
448
 
1033    106     2
449
 
1034    106     2
450
 
1204    107     2
451
 
1203    107     2
452
 
1021    103     2
453
 
1158    100     0
454
 
1194    105     2
455
 
1041    107     2
456
 
1003    101     1
457
 
1016    102     2
458
 
1007    101     1
459
 
1035    106     2
460
 
1036    106     2
461
 
1017    103     2
462
 
1008    101     1
463
 
1037    107     2
464
 
1019    103     2
465
 
1027    105     2
466
 
1028    105     2
467
 
1184    104     2
468
 
1039    107     2
469
 
1026    105     2
470
 
1038    107     2
471
 
1022    104     2
472
 
1020    103     2
473
 
1006    101     1
474
 
1180    105     2
475
 
update ignore t1 set id=1023 where id=1010;
476
 
select * from t1 where parent_id=102;
477
 
id      parent_id       level
478
 
1009    102     2
479
 
1025    102     2
480
 
1016    102     2
481
 
explain select level from t1 where level=1;
482
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
483
 
1       SIMPLE  t1      ref     level   level   4       const   #       Using index
484
 
select level,id from t1 where level=1;
485
 
level   id
486
 
1       1004
487
 
1       1005
488
 
1       1003
489
 
1       1007
490
 
1       1008
491
 
1       1006
492
 
select level,id,parent_id from t1 where level=1;
493
 
level   id      parent_id
494
 
1       1004    101
495
 
1       1005    101
496
 
1       1003    101
497
 
1       1007    101
498
 
1       1008    101
499
 
1       1006    101
500
 
select level,id from t1 where level=1 order by id;
501
 
level   id
502
 
1       1003
503
 
1       1004
504
 
1       1005
505
 
1       1006
506
 
1       1007
507
 
1       1008
508
 
delete from t1 where level=1;
509
 
select * from t1;
510
 
id      parent_id       level
511
 
1002    100     0
512
 
1009    102     2
513
 
1025    102     2
514
 
1018    103     2
515
 
1023    104     2
516
 
1025    104     2
517
 
1029    105     2
518
 
1030    105     2
519
 
1031    105     2
520
 
1032    106     2
521
 
1033    106     2
522
 
1034    106     2
523
 
1204    107     2
524
 
1203    107     2
525
 
1021    103     2
526
 
1158    100     0
527
 
1194    105     2
528
 
1041    107     2
529
 
1016    102     2
530
 
1035    106     2
531
 
1036    106     2
532
 
1017    103     2
533
 
1037    107     2
534
 
1019    103     2
535
 
1027    105     2
536
 
1028    105     2
537
 
1184    104     2
538
 
1039    107     2
539
 
1026    105     2
540
 
1038    107     2
541
 
1022    104     2
542
 
1020    103     2
543
 
1180    105     2
544
 
drop table t1;
545
 
create TEMPORARY table t1 (
546
 
sca_code char(6) NOT NULL,
547
 
cat_code char(6) NOT NULL,
548
 
sca_desc varchar(50),
549
 
lan_code char(2) NOT NULL,
550
 
sca_pic varchar(100),
551
 
sca_sdesc varchar(50),
552
 
sca_sch_desc varchar(16),
553
 
PRIMARY KEY (sca_code, cat_code, lan_code),
554
 
INDEX sca_pic (sca_pic)
555
 
) engine = MyISAM ;
556
 
INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
557
 
select count(*) from t1 where sca_code = 'PD';
558
 
count(*)
559
 
1
560
 
select count(*) from t1 where sca_code <= 'PD';
561
 
count(*)
562
 
1
563
 
select count(*) from t1 where sca_pic is null;
564
 
count(*)
565
 
2
566
 
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
567
 
select count(*) from t1 where sca_code='PD' and sca_pic is null;
568
 
count(*)
569
 
1
570
 
select count(*) from t1 where cat_code='E';
571
 
count(*)
572
 
0
573
 
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
574
 
select count(*) from t1 where sca_code='PD' and sca_pic is null;
575
 
count(*)
576
 
1
577
 
select count(*) from t1 where sca_pic >= 'n';
578
 
count(*)
579
 
1
580
 
select sca_pic from t1 where sca_pic is null;
581
 
sca_pic
582
 
NULL
583
 
NULL
584
 
update t1 set sca_pic="test" where sca_pic is null;
585
 
delete from t1 where sca_code='pd';
586
 
drop table t1;
587
 
TEMPORARY
588
 
create TEMPORARY table t1 (a varchar(100) not null, primary key(a), b int not null) engine=MyISAM;
589
 
insert into t1 values("hello",1),("world",2);
590
 
select * from t1 order by b desc;
591
 
a       b
592
 
world   2
593
 
hello   1
594
 
alter table t1 ENGINE=MyISAM;
595
 
drop table t1;
596
 
create TEMPORARY table t1 (i int, j int ) ENGINE=MyISAM;
597
 
insert into t1 values (1,2);
598
 
select * from t1 where i=1 and j=2;
599
 
i       j
600
 
1       2
601
 
create index ax1 on t1 (i,j);
602
 
select * from t1 where i=1 and j=2;
603
 
i       j
604
 
1       2
605
 
drop table t1;
606
 
create TEMPORARY table t1 (
607
 
a int NOT NULL,
608
 
b int NOT NULL,
609
 
UNIQUE (a, b)
610
 
) ENGINE = MyISAM;
611
 
INSERT INTO t1 VALUES (1, 1);
612
 
SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
613
 
MIN(B)  MAX(b)
614
 
1       1
615
 
drop table t1;
616
 
create TEMPORARY table t1 (a int NOT NULL) engine=MyISAM;
617
 
INSERT INTO t1 VALUES (1);
618
 
SELECT * FROM t1;
619
 
a
620
 
1
621
 
DROP TABLE t1;
622
 
create TEMPORARY table t1 (a int  primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = MyISAM;
623
 
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
624
 
explain select * from t1 where a > 0 and a < 50;
625
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
626
 
1       SIMPLE  t1      system  PRIMARY NULL    NULL    NULL    #       
627
 
drop table t1;
628
 
create TEMPORARY table t1 (a char(20), unique (a(5))) engine=MyISAM;
629
 
drop table t1;
630
 
create TEMPORARY table t1 (a char(20), index (a(5))) engine=MyISAM;
631
 
show create table t1;
632
 
Table   Create Table
633
 
t1      CREATE TEMPORARY TABLE `t1` (
634
 
  `a` varchar(20) DEFAULT NULL,
635
 
  KEY `a` (`a`(5))
636
 
) ENGINE=MyISAM
637
 
drop table t1;
638
 
create temporary table t1 (a int not null auto_increment, primary key(a)) engine=MyISAM;
639
 
insert into t1 values (NULL),(NULL),(NULL);
640
 
delete from t1 where a=3;
641
 
insert into t1 values (NULL);
642
 
select * from t1;
643
 
a
644
 
1
645
 
2
646
 
4
647
 
alter table t1 add b int;
648
 
select * from t1;
649
 
a       b
650
 
1       NULL
651
 
2       NULL
652
 
4       NULL
653
 
drop table t1;
654
 
create TEMPORARY table t1
655
 
(
656
 
id int auto_increment primary key,
657
 
name varchar(32) not null,
658
 
value text not null,
659
 
uid int not null,
660
 
unique key(name,uid)
661
 
) engine=MyISAM;
662
 
insert into t1 values (1,'one','one value',101),
663
 
(2,'two','two value',102),(3,'three','three value',103);
664
 
replace into t1 (value,name,uid) values ('other value','two',102);
665
 
delete from t1 where uid=102;
666
 
replace into t1 (value,name,uid) values ('other value','two',102);
667
 
replace into t1 (value,name,uid) values ('other value','two',102);
668
 
select * from t1;
669
 
id      name    value   uid
670
 
1       one     one value       101
671
 
6       two     other value     102
672
 
3       three   three value     103
673
 
drop table t1;
674
 
create database mysqltest;
675
 
create TEMPORARY table mysqltest.t1 (a int not null) engine= MyISAM;
676
 
insert into mysqltest.t1 values(1);
677
 
create TEMPORARY table mysqltest.t2 (a int not null) engine= MEMORY;
678
 
insert into mysqltest.t2 values(1);
679
 
create TEMPORARY table mysqltest.t3 (a int not null) engine= MEMORY;
680
 
insert into mysqltest.t3 values(1);
681
 
commit;
682
 
drop database mysqltest;
683
 
show tables from mysqltest;
684
 
ERROR 42000: Unknown database 'mysqltest'
685
 
set autocommit=0;
686
 
create TEMPORARY table t1 (a int not null) engine= MyISAM;
687
 
insert into t1 values(1),(2);
688
 
truncate table t1;
689
 
commit;
690
 
truncate table t1;
691
 
truncate table t1;
692
 
select * from t1;
693
 
a
694
 
insert into t1 values(1),(2);
695
 
delete from t1;
696
 
select * from t1;
697
 
a
698
 
commit;
699
 
drop table t1;
700
 
set autocommit=1;
701
 
create TEMPORARY table t1 (a int not null) engine= MyISAM;
702
 
insert into t1 values(1),(2);
703
 
truncate table t1;
704
 
insert into t1 values(1),(2);
705
 
select * from t1;
706
 
a
707
 
1
708
 
2
709
 
truncate table t1;
710
 
insert into t1 values(1),(2);
711
 
delete from t1;
712
 
select * from t1;
713
 
a
714
 
drop table t1;
715
 
create TEMPORARY table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=MyISAM;
716
 
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
717
 
explain select * from t1 order by a;
718
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
719
 
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    #       Using filesort
720
 
explain select * from t1 order by b;
721
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
722
 
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    #       Using filesort
723
 
explain select * from t1 order by c;
724
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
725
 
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    #       Using filesort
726
 
explain select a from t1 order by a;
727
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
728
 
1       SIMPLE  t1      index   NULL    PRIMARY 4       NULL    #       Using index
729
 
explain select b from t1 order by b;
730
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
731
 
1       SIMPLE  t1      index   NULL    b       4       NULL    #       Using index
732
 
explain select a,b from t1 order by b;
733
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
734
 
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    #       Using filesort
735
 
explain select a,b from t1;
736
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
737
 
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    #       
738
 
explain select a,b,c from t1;
739
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
740
 
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    #       
741
 
drop table t1;
742
 
create TEMPORARY table t1 (t int not null default 1, key (t)) engine=MyISAM;
743
 
drop table t1;
744
 
create TEMPORARY table t1 (id int not null auto_increment, code int not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=MyISAM;
745
 
BEGIN;
746
 
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
747
 
SELECT @@tx_isolation,@@global.tx_isolation;
748
 
@@tx_isolation  @@global.tx_isolation
749
 
SERIALIZABLE    REPEATABLE-READ
750
 
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
751
 
select id, code, name from t1 order by id;
752
 
id      code    name
753
 
1       1       Tim
754
 
2       1       Monty
755
 
3       2       David
756
 
COMMIT;
757
 
BEGIN;
758
 
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
759
 
insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
760
 
select id, code, name from t1 order by id;
761
 
id      code    name
762
 
1       1       Tim
763
 
2       1       Monty
764
 
3       2       David
765
 
4       2       Erik
766
 
5       3       Sasha
767
 
COMMIT;
768
 
BEGIN;
769
 
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
770
 
insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
771
 
select id, code, name from t1 order by id;
772
 
id      code    name
773
 
1       1       Tim
774
 
2       1       Monty
775
 
3       2       David
776
 
4       2       Erik
777
 
5       3       Sasha
778
 
6       3       Jeremy
779
 
7       4       Matt
780
 
COMMIT;
781
 
DROP TABLE t1;
782
 
create TEMPORARY table t1 (a int not null primary key, b int not null, unique (b)) engine=MyISAM;
783
 
INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
784
 
UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
785
 
SELECT * from t1;
786
 
a       b
787
 
1       1
788
 
102     2
789
 
103     3
790
 
4       4
791
 
5       5
792
 
6       6
793
 
7       7
794
 
8       8
795
 
9       9
796
 
drop table t1;
797
 
create TEMPORARY table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=MyISAM;
798
 
create TEMPORARY table t2 (a int not null auto_increment primary key, b int) ENGINE = MEMORY;
799
 
insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
800
 
insert into t2 (a) select b from t1;
801
 
insert into t1 (b) select b from t2;
802
 
insert into t2 (a) select b from t1;
803
 
insert into t1 (a) select b from t2;
804
 
insert into t2 (a) select b from t1;
805
 
insert into t1 (a) select b from t2;
806
 
insert into t2 (a) select b from t1;
807
 
insert into t1 (a) select b from t2;
808
 
insert into t2 (a) select b from t1;
809
 
insert into t1 (a) select b from t2;
810
 
insert into t2 (a) select b from t1;
811
 
insert into t1 (a) select b from t2;
812
 
insert into t2 (a) select b from t1;
813
 
insert into t1 (a) select b from t2;
814
 
insert into t2 (a) select b from t1;
815
 
insert into t1 (a) select b from t2;
816
 
insert into t2 (a) select b from t1;
817
 
insert into t1 (a) select b from t2;
818
 
select count(*) from t1;
819
 
count(*)
820
 
29267
821
 
explain select * from t1 where c between 1 and 2500;
822
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
823
 
1       SIMPLE  t1      range   c       c       5       NULL    #       Using where
824
 
update t1 set c=a;
825
 
explain select * from t1 where c between 1 and 2500;
826
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
827
 
1       SIMPLE  t1      range   c       c       5       NULL    #       Using where
828
 
drop table t1,t2;
829
 
create TEMPORARY table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=MyISAM;
830
 
insert into t1 (id) values (null),(null),(null),(null),(null);
831
 
update t1 set fk=69 where fk is null order by id limit 1;
832
 
SELECT * from t1;
833
 
id      fk
834
 
1       69
835
 
2       NULL
836
 
3       NULL
837
 
4       NULL
838
 
5       NULL
839
 
drop table t1;
840
 
create TEMPORARY table t1 (a int not null, b int not null, key (a)) engine=MyISAM;
841
 
insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
842
 
SET @tmp=0;
843
 
update t1 set b=(@tmp:=@tmp+1) order by a;
844
 
update t1 set b=99 where a=1 order by b asc limit 1;
845
 
update t1 set b=100 where a=1 order by b desc limit 2;
846
 
update t1 set a=a+10+b where a=1 order by b;
847
 
select * from t1 order by a,b;
848
 
a       b
849
 
2       4
850
 
2       5
851
 
2       6
852
 
3       7
853
 
3       8
854
 
3       9
855
 
3       10
856
 
3       11
857
 
3       12
858
 
13      2
859
 
111     100
860
 
111     100
861
 
drop table t1;
862
 
SET AUTOCOMMIT=1;
863
 
create TEMPORARY table t1 (a integer auto_increment primary key) engine=MyISAM;
864
 
insert into t1 (a) values (NULL),(NULL);
865
 
truncate table t1;
866
 
insert into t1 (a) values (NULL),(NULL);
867
 
SELECT * from t1;
868
 
a
869
 
1
870
 
2
871
 
drop table t1;
872
 
create TEMPORARY table t1 (col1 int)ENGINE=MyISAM;
873
 
create TEMPORARY table t2 (col1 int,stamp TIMESTAMP,INDEX stamp_idx
874
 
(stamp))ENGINE=MyISAM;
875
 
insert into t1 values (1),(2),(3);
876
 
insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
877
 
ERROR HY000: Received an invalid value '20020204310000' for a UNIX timestamp.
878
 
SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
879
 
'20020204120000' GROUP BY col1;
880
 
col1
881
 
1
882
 
2
883
 
3
884
 
drop table t1,t2;
885
 
create TEMPORARY table t1 (a int, b varchar(200), c text not null) engine=MyISAM;
886
 
create TEMPORARY table t2 (a int, b varchar(200), c text not null) engine=MyISAM;
887
 
create TEMPORARY table t3 (a int, b varchar(200), c varchar(200) not null) engine=MEMORY;
888
 
create TEMPORARY table t4 (a int, b varchar(200), c varchar(200) not null) engine=MEMORY;
889
 
create TEMPORARY table t5 (a int, b varchar(200), c text not null) engine=MyISAM;
890
 
create TEMPORARY table t6 (a int, b varchar(200), c text not null) engine=MyISAM;
891
 
insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
892
 
insert t2 select * from t1;
893
 
insert t3 select * from t1;
894
 
insert t4 select * from t1;
895
 
insert t5 select * from t1;
896
 
insert t6 select * from t1;
897
 
checksum table t1, t2, t3, t4, t5, t6, t7;
898
 
Table   Checksum
899
 
test.t1 2948697075
900
 
test.t2 2948697075
901
 
test.t3 3505595080
902
 
test.t4 3505595080
903
 
test.t5 2948697075
904
 
test.t6 2948697075
905
 
test.t7 NULL
906
 
Warnings:
907
 
Error   1146    Table 'test.t7' doesn't exist
908
 
checksum table t1, t2, t3, t4, t5, t6, t7;
909
 
Table   Checksum
910
 
test.t1 2948697075
911
 
test.t2 2948697075
912
 
test.t3 3505595080
913
 
test.t4 3505595080
914
 
test.t5 2948697075
915
 
test.t6 2948697075
916
 
test.t7 NULL
917
 
Warnings:
918
 
Error   1146    Table 'test.t7' doesn't exist
919
 
checksum table t1, t2, t3, t4, t5, t6, t7;
920
 
Table   Checksum
921
 
test.t1 2948697075
922
 
test.t2 2948697075
923
 
test.t3 3505595080
924
 
test.t4 3505595080
925
 
test.t5 2948697075
926
 
test.t6 2948697075
927
 
test.t7 NULL
928
 
Warnings:
929
 
Error   1146    Table 'test.t7' doesn't exist
930
 
drop table t1,t2,t3, t4, t5, t6;
931
 
create TEMPORARY table t1 (a int) engine=MyISAM;
932
 
create table t2 like t1;
933
 
ERROR HY000: Can't create table 'test.t2' (errno: 138)
934
 
create table t2 like t1 engine=innodb;
935
 
show create table t2;
936
 
Table   Create Table
937
 
t2      CREATE TABLE `t2` (
938
 
  `a` int DEFAULT NULL
939
 
) ENGINE=InnoDB
940
 
drop table t1,t2;
941
 
flush status;
942
 
show status like "binlog_cache_use";
943
 
Variable_name   Value
944
 
show status like "binlog_cache_disk_use";
945
 
Variable_name   Value
946
 
create TEMPORARY table t1 (a int) engine=MyISAM;
947
 
show status like "binlog_cache_use";
948
 
Variable_name   Value
949
 
show status like "binlog_cache_disk_use";
950
 
Variable_name   Value
951
 
begin;
952
 
delete from t1;
953
 
commit;
954
 
show status like "binlog_cache_use";
955
 
Variable_name   Value
956
 
show status like "binlog_cache_disk_use";
957
 
Variable_name   Value
958
 
drop table t1;
959
 
create TEMPORARY table t1 (c char(10), index (c,c)) engine=MyISAM;
960
 
ERROR 42S21: Duplicate column name 'c'
961
 
create TEMPORARY table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=MyISAM;
962
 
ERROR 42S21: Duplicate column name 'c1'
963
 
create TEMPORARY table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=MyISAM;
964
 
ERROR 42S21: Duplicate column name 'c1'
965
 
create TEMPORARY table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=MyISAM;
966
 
ERROR 42S21: Duplicate column name 'c1'
967
 
create TEMPORARY table t1 (c1 char(10), c2 char(10)) engine=MyISAM;
968
 
alter table t1 add key (c1,c1);
969
 
ERROR 42S21: Duplicate column name 'c1'
970
 
alter table t1 add key (c2,c1,c1);
971
 
ERROR 42S21: Duplicate column name 'c1'
972
 
alter table t1 add key (c1,c2,c1);
973
 
ERROR 42S21: Duplicate column name 'c1'
974
 
alter table t1 add key (c1,c1,c2);
975
 
ERROR 42S21: Duplicate column name 'c1'
976
 
drop table t1;
977
 
create TEMPORARY table t1(a int, b int) engine=MyISAM;
978
 
insert into t1 values ('1111', '3333');
979
 
select distinct concat(a, b) from t1;
980
 
concat(a, b)
981
 
11113333
982
 
drop table t1;
983
 
create temporary table t1 (a int) engine=MyISAM;
984
 
insert into t1 values (4711);
985
 
truncate t1;
986
 
insert into t1 values (42);
987
 
select * from t1;
988
 
a
989
 
42
990
 
drop table t1;
991
 
create TEMPORARY table t1 (a int) engine=MyISAM;
992
 
insert into t1 values (4711);
993
 
truncate t1;
994
 
insert into t1 values (42);
995
 
select * from t1;
996
 
a
997
 
42
998
 
drop table t1;
999
 
create TEMPORARY table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=MyISAM;
1000
 
insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
1001
 
select * from t1 order by a,b,c,d;
1002
 
a       b       c       d       e
1003
 
1       1       a       1       1
1004
 
2       2       b       2       2
1005
 
3       3       ab      3       3
1006
 
explain select * from t1 order by a,b,c,d;
1007
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1008
 
1       SIMPLE  t1      ALL     NULL    NULL    NULL    NULL    3       Using filesort
1009
 
drop table t1;
1010
 
create TEMPORARY table t1 (a char(1), b char(1), key(a, b)) engine=MyISAM;
1011
 
insert into t1 values ('8', '6'), ('4', '7');
1012
 
select min(a) from t1;
1013
 
min(a)
1014
 
4
1015
 
select min(b) from t1 where a='8';
1016
 
min(b)
1017
 
6
1018
 
drop table t1;
1019
 
create TEMPORARY table t1 (x bigint not null primary key) engine=MyISAM;
1020
 
insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
1021
 
ERROR 22003: Out of range value for column 'x' at row 1
1022
 
select * from t1;
1023
 
x
1024
 
select count(*) from t1 where x>0;
1025
 
count(*)
1026
 
0
1027
 
select count(*) from t1 where x=0;
1028
 
count(*)
1029
 
0
1030
 
select count(*) from t1 where x<0;
1031
 
count(*)
1032
 
0
1033
 
select count(*) from t1 where x < -16;
1034
 
count(*)
1035
 
0
1036
 
select count(*) from t1 where x = -16;
1037
 
count(*)
1038
 
0
1039
 
explain select count(*) from t1 where x > -16;
1040
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1041
 
1       SIMPLE  NULL    NULL    NULL    NULL    NULL    NULL    NULL    Impossible WHERE noticed after reading const tables
1042
 
select count(*) from t1 where x > -16;
1043
 
count(*)
1044
 
0
1045
 
select * from t1 where x > -16;
1046
 
x
1047
 
select count(*) from t1 where x = 18446744073709551601;
1048
 
count(*)
1049
 
0
1050
 
drop table t1;
1051
 
set storage_engine=MyISAM;
1052
 
drop table if exists t1,t2,t3;
1053
 
--- Testing varchar ---
1054
 
--- Testing varchar ---
1055
 
create TEMPORARY table t1 (v varchar(10), c char(10), t text);
1056
 
insert into t1 values('+ ', '+ ', '+ ');
1057
 
set @a=repeat(' ',20);
1058
 
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
1059
 
Warnings:
1060
 
Note    1265    Data truncated for column 'v' at row 1
1061
 
Note    1265    Data truncated for column 'c' at row 1
1062
 
select concat('*',v,'*',c,'*',t,'*') from t1;
1063
 
concat('*',v,'*',c,'*',t,'*')
1064
 
*+ *+ *+ *
1065
 
*+         *+         *+                    *
1066
 
show create table t1;
1067
 
Table   Create Table
1068
 
t1      CREATE TEMPORARY TABLE `t1` (
1069
 
  `v` varchar(10) DEFAULT NULL,
1070
 
  `c` varchar(10) DEFAULT NULL,
1071
 
  `t` text
1072
 
) ENGINE=MyISAM
1073
 
create TEMPORARY table t2 like t1;
1074
 
show create table t2;
1075
 
Table   Create Table
1076
 
t2      CREATE TEMPORARY TABLE `t2` (
1077
 
  `v` varchar(10) DEFAULT NULL,
1078
 
  `c` varchar(10) DEFAULT NULL,
1079
 
  `t` text
1080
 
) ENGINE=MyISAM
1081
 
create TEMPORARY table t3 select * from t1;
1082
 
show create table t3;
1083
 
Table   Create Table
1084
 
t3      CREATE TEMPORARY TABLE `t3` (
1085
 
  `v` varchar(10) DEFAULT NULL,
1086
 
  `c` varchar(10) DEFAULT NULL,
1087
 
  `t` text
1088
 
) ENGINE=MyISAM
1089
 
alter table t1 modify c varchar(10);
1090
 
show create table t1;
1091
 
Table   Create Table
1092
 
t1      CREATE TEMPORARY TABLE `t1` (
1093
 
  `v` varchar(10) DEFAULT NULL,
1094
 
  `c` varchar(10) DEFAULT NULL,
1095
 
  `t` text
1096
 
) ENGINE=MyISAM
1097
 
alter table t1 modify v char(10);
1098
 
show create table t1;
1099
 
Table   Create Table
1100
 
t1      CREATE TEMPORARY TABLE `t1` (
1101
 
  `v` varchar(10) DEFAULT NULL,
1102
 
  `c` varchar(10) DEFAULT NULL,
1103
 
  `t` text
1104
 
) ENGINE=MyISAM
1105
 
alter table t1 modify t varchar(10);
1106
 
Warnings:
1107
 
Note    1265    Data truncated for column 't' at row 2
1108
 
show create table t1;
1109
 
Table   Create Table
1110
 
t1      CREATE TEMPORARY TABLE `t1` (
1111
 
  `v` varchar(10) DEFAULT NULL,
1112
 
  `c` varchar(10) DEFAULT NULL,
1113
 
  `t` varchar(10) DEFAULT NULL
1114
 
) ENGINE=MyISAM
1115
 
select concat('*',v,'*',c,'*',t,'*') from t1;
1116
 
concat('*',v,'*',c,'*',t,'*')
1117
 
*+ *+ *+ *
1118
 
*+         *+         *+         *
1119
 
drop table t1,t2,t3;
1120
 
create TEMPORARY table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
1121
 
show create table t1;
1122
 
Table   Create Table
1123
 
t1      CREATE TEMPORARY TABLE `t1` (
1124
 
  `v` varchar(10) DEFAULT NULL,
1125
 
  `c` varchar(10) DEFAULT NULL,
1126
 
  `t` text,
1127
 
  KEY `v` (`v`),
1128
 
  KEY `c` (`c`),
1129
 
  KEY `t` (`t`(10))
1130
 
) ENGINE=MyISAM
1131
 
select count(*) from t1;
1132
 
count(*)
1133
 
270
1134
 
insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
1135
 
select count(*) from t1 where v='a';
1136
 
count(*)
1137
 
10
1138
 
select count(*) from t1 where c='a';
1139
 
count(*)
1140
 
10
1141
 
select count(*) from t1 where t='a';
1142
 
count(*)
1143
 
10
1144
 
select count(*) from t1 where v='a  ';
1145
 
count(*)
1146
 
10
1147
 
select count(*) from t1 where c='a  ';
1148
 
count(*)
1149
 
10
1150
 
select count(*) from t1 where t='a  ';
1151
 
count(*)
1152
 
10
1153
 
select count(*) from t1 where v between 'a' and 'a ';
1154
 
count(*)
1155
 
10
1156
 
select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
1157
 
count(*)
1158
 
10
1159
 
select count(*) from t1 where v like 'a%';
1160
 
count(*)
1161
 
11
1162
 
select count(*) from t1 where c like 'a%';
1163
 
count(*)
1164
 
11
1165
 
select count(*) from t1 where t like 'a%';
1166
 
count(*)
1167
 
11
1168
 
select count(*) from t1 where v like 'a %';
1169
 
count(*)
1170
 
9
1171
 
explain select count(*) from t1 where v='a  ';
1172
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1173
 
1       SIMPLE  t1      ref     v       v       43      const   #       Using where; Using index
1174
 
explain select count(*) from t1 where c='a  ';
1175
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1176
 
1       SIMPLE  t1      ref     c       c       43      const   #       Using where; Using index
1177
 
explain select count(*) from t1 where t='a  ';
1178
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1179
 
1       SIMPLE  t1      ref     t       t       43      const   #       Using where
1180
 
explain select count(*) from t1 where v like 'a%';
1181
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1182
 
1       SIMPLE  t1      range   v       v       43      NULL    #       Using where; Using index
1183
 
explain select count(*) from t1 where v between 'a' and 'a ';
1184
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1185
 
1       SIMPLE  t1      ref     v       v       43      const   #       Using where; Using index
1186
 
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
1187
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1188
 
1       SIMPLE  t1      ref     v       v       43      const   #       Using where; Using index
1189
 
alter table t1 add unique(v);
1190
 
ERROR 23000: Duplicate entry '{ ' for key 'v_2'
1191
 
alter table t1 add key(v);
1192
 
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
1193
 
qq
1194
 
*a*a*a*
1195
 
*a *a *a *
1196
 
*a  *a  *a  *
1197
 
*a   *a   *a   *
1198
 
*a    *a    *a    *
1199
 
*a     *a     *a     *
1200
 
*a      *a      *a      *
1201
 
*a       *a       *a       *
1202
 
*a        *a        *a        *
1203
 
*a         *a         *a         *
1204
 
explain select * from t1 where v='a';
1205
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1206
 
1       SIMPLE  t1      ref     v,v_2   #       43      const   #       Using where
1207
 
select v,count(*) from t1 group by v limit 10;
1208
 
v       count(*)
1209
 
a      1
1210
 
a       10
1211
 
b       10
1212
 
c       10
1213
 
d       10
1214
 
e       10
1215
 
f       10
1216
 
g       10
1217
 
h       10
1218
 
i       10
1219
 
select v,count(t) from t1 group by v limit 10;
1220
 
v       count(t)
1221
 
a      1
1222
 
a       10
1223
 
b       10
1224
 
c       10
1225
 
d       10
1226
 
e       10
1227
 
f       10
1228
 
g       10
1229
 
h       10
1230
 
i       10
1231
 
select v,count(c) from t1 group by v limit 10;
1232
 
v       count(c)
1233
 
a      1
1234
 
a       10
1235
 
b       10
1236
 
c       10
1237
 
d       10
1238
 
e       10
1239
 
f       10
1240
 
g       10
1241
 
h       10
1242
 
i       10
1243
 
select sql_big_result v,count(t) from t1 group by v limit 10;
1244
 
v       count(t)
1245
 
a      1
1246
 
a       10
1247
 
b       10
1248
 
c       10
1249
 
d       10
1250
 
e       10
1251
 
f       10
1252
 
g       10
1253
 
h       10
1254
 
i       10
1255
 
select sql_big_result v,count(c) from t1 group by v limit 10;
1256
 
v       count(c)
1257
 
a      1
1258
 
a       10
1259
 
b       10
1260
 
c       10
1261
 
d       10
1262
 
e       10
1263
 
f       10
1264
 
g       10
1265
 
h       10
1266
 
i       10
1267
 
select c,count(*) from t1 group by c limit 10;
1268
 
c       count(*)
1269
 
a      1
1270
 
a       10
1271
 
b       10
1272
 
c       10
1273
 
d       10
1274
 
e       10
1275
 
f       10
1276
 
g       10
1277
 
h       10
1278
 
i       10
1279
 
select c,count(t) from t1 group by c limit 10;
1280
 
c       count(t)
1281
 
a      1
1282
 
a       10
1283
 
b       10
1284
 
c       10
1285
 
d       10
1286
 
e       10
1287
 
f       10
1288
 
g       10
1289
 
h       10
1290
 
i       10
1291
 
select sql_big_result c,count(t) from t1 group by c limit 10;
1292
 
c       count(t)
1293
 
a      1
1294
 
a       10
1295
 
b       10
1296
 
c       10
1297
 
d       10
1298
 
e       10
1299
 
f       10
1300
 
g       10
1301
 
h       10
1302
 
i       10
1303
 
select t,count(*) from t1 group by t limit 10;
1304
 
t       count(*)
1305
 
a      1
1306
 
a       10
1307
 
b       10
1308
 
c       10
1309
 
d       10
1310
 
e       10
1311
 
f       10
1312
 
g       10
1313
 
h       10
1314
 
i       10
1315
 
select t,count(t) from t1 group by t limit 10;
1316
 
t       count(t)
1317
 
a      1
1318
 
a       10
1319
 
b       10
1320
 
c       10
1321
 
d       10
1322
 
e       10
1323
 
f       10
1324
 
g       10
1325
 
h       10
1326
 
i       10
1327
 
select sql_big_result t,count(t) from t1 group by t limit 10;
1328
 
t       count(t)
1329
 
a      1
1330
 
a       10
1331
 
b       10
1332
 
c       10
1333
 
d       10
1334
 
e       10
1335
 
f       10
1336
 
g       10
1337
 
h       10
1338
 
i       10
1339
 
alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
1340
 
show create table t1;
1341
 
Table   Create Table
1342
 
t1      CREATE TEMPORARY TABLE `t1` (
1343
 
  `v` varchar(300) DEFAULT NULL,
1344
 
  `c` varchar(10) DEFAULT NULL,
1345
 
  `t` text,
1346
 
  KEY `c` (`c`),
1347
 
  KEY `t` (`t`(10)),
1348
 
  KEY `v` (`v`)
1349
 
) ENGINE=MyISAM
1350
 
select count(*) from t1 where v='a';
1351
 
count(*)
1352
 
10
1353
 
select count(*) from t1 where v='a  ';
1354
 
count(*)
1355
 
10
1356
 
select count(*) from t1 where v between 'a' and 'a ';
1357
 
count(*)
1358
 
10
1359
 
select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
1360
 
count(*)
1361
 
10
1362
 
select count(*) from t1 where v like 'a%';
1363
 
count(*)
1364
 
11
1365
 
select count(*) from t1 where v like 'a %';
1366
 
count(*)
1367
 
9
1368
 
explain select count(*) from t1 where v='a  ';
1369
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1370
 
1       SIMPLE  t1      ref     v       v       1203    const   #       Using where; Using index
1371
 
explain select count(*) from t1 where v like 'a%';
1372
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1373
 
1       SIMPLE  t1      range   v       v       1203    NULL    #       Using where; Using index
1374
 
explain select count(*) from t1 where v between 'a' and 'a ';
1375
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1376
 
1       SIMPLE  t1      ref     v       v       1203    const   #       Using where; Using index
1377
 
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
1378
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1379
 
1       SIMPLE  t1      ref     v       v       1203    const   #       Using where; Using index
1380
 
explain select * from t1 where v='a';
1381
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1382
 
1       SIMPLE  t1      ref     v       v       1203    const   #       Using where
1383
 
select v,count(*) from t1 group by v limit 10;
1384
 
v       count(*)
1385
 
a      1
1386
 
a       10
1387
 
b       10
1388
 
c       10
1389
 
d       10
1390
 
e       10
1391
 
f       10
1392
 
g       10
1393
 
h       10
1394
 
i       10
1395
 
select v,count(t) from t1 group by v limit 10;
1396
 
v       count(t)
1397
 
a      1
1398
 
a       10
1399
 
b       10
1400
 
c       10
1401
 
d       10
1402
 
e       10
1403
 
f       10
1404
 
g       10
1405
 
h       10
1406
 
i       10
1407
 
select sql_big_result v,count(t) from t1 group by v limit 10;
1408
 
v       count(t)
1409
 
a      1
1410
 
a       10
1411
 
b       10
1412
 
c       10
1413
 
d       10
1414
 
e       10
1415
 
f       10
1416
 
g       10
1417
 
h       10
1418
 
i       10
1419
 
alter table t1 drop key v, add key v (v(30));
1420
 
show create table t1;
1421
 
Table   Create Table
1422
 
t1      CREATE TEMPORARY TABLE `t1` (
1423
 
  `v` varchar(300) DEFAULT NULL,
1424
 
  `c` varchar(10) DEFAULT NULL,
1425
 
  `t` text,
1426
 
  KEY `c` (`c`),
1427
 
  KEY `t` (`t`(10)),
1428
 
  KEY `v` (`v`(30))
1429
 
) ENGINE=MyISAM
1430
 
select count(*) from t1 where v='a';
1431
 
count(*)
1432
 
10
1433
 
select count(*) from t1 where v='a  ';
1434
 
count(*)
1435
 
10
1436
 
select count(*) from t1 where v between 'a' and 'a ';
1437
 
count(*)
1438
 
10
1439
 
select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
1440
 
count(*)
1441
 
10
1442
 
select count(*) from t1 where v like 'a%';
1443
 
count(*)
1444
 
11
1445
 
select count(*) from t1 where v like 'a %';
1446
 
count(*)
1447
 
9
1448
 
explain select count(*) from t1 where v='a  ';
1449
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1450
 
1       SIMPLE  t1      ref     v       v       123     const   #       Using where
1451
 
explain select count(*) from t1 where v like 'a%';
1452
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1453
 
1       SIMPLE  t1      range   v       v       123     NULL    #       Using where
1454
 
explain select count(*) from t1 where v between 'a' and 'a ';
1455
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1456
 
1       SIMPLE  t1      ref     v       v       123     const   #       Using where
1457
 
explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a  ' and 'b\n';
1458
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1459
 
1       SIMPLE  t1      ref     v       v       123     const   #       Using where
1460
 
explain select * from t1 where v='a';
1461
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1462
 
1       SIMPLE  t1      ref     v       v       123     const   #       Using where
1463
 
select v,count(*) from t1 group by v limit 10;
1464
 
v       count(*)
1465
 
a      1
1466
 
a       10
1467
 
b       10
1468
 
c       10
1469
 
d       10
1470
 
e       10
1471
 
f       10
1472
 
g       10
1473
 
h       10
1474
 
i       10
1475
 
select v,count(t) from t1 group by v limit 10;
1476
 
v       count(t)
1477
 
a      1
1478
 
a       10
1479
 
b       10
1480
 
c       10
1481
 
d       10
1482
 
e       10
1483
 
f       10
1484
 
g       10
1485
 
h       10
1486
 
i       10
1487
 
select sql_big_result v,count(t) from t1 group by v limit 10;
1488
 
v       count(t)
1489
 
a      1
1490
 
a       10
1491
 
b       10
1492
 
c       10
1493
 
d       10
1494
 
e       10
1495
 
f       10
1496
 
g       10
1497
 
h       10
1498
 
i       10
1499
 
alter table t1 modify v varchar(600), drop key v, add key v (v);
1500
 
Warnings:
1501
 
Warning 1071    Specified key was too long; max key length is 1332 bytes
1502
 
show create table t1;
1503
 
Table   Create Table
1504
 
t1      CREATE TEMPORARY TABLE `t1` (
1505
 
  `v` varchar(600) DEFAULT NULL,
1506
 
  `c` varchar(10) DEFAULT NULL,
1507
 
  `t` text,
1508
 
  KEY `c` (`c`),
1509
 
  KEY `t` (`t`(10)),
1510
 
  KEY `v` (`v`(333))
1511
 
) ENGINE=MyISAM
1512
 
select v,count(*) from t1 group by v limit 10;
1513
 
v       count(*)
1514
 
a      1
1515
 
a       10
1516
 
b       10
1517
 
c       10
1518
 
d       10
1519
 
e       10
1520
 
f       10
1521
 
g       10
1522
 
h       10
1523
 
i       10
1524
 
select v,count(t) from t1 group by v limit 10;
1525
 
v       count(t)
1526
 
a      1
1527
 
a       10
1528
 
b       10
1529
 
c       10
1530
 
d       10
1531
 
e       10
1532
 
f       10
1533
 
g       10
1534
 
h       10
1535
 
i       10
1536
 
select sql_big_result v,count(t) from t1 group by v limit 10;
1537
 
v       count(t)
1538
 
a      1
1539
 
a       10
1540
 
b       10
1541
 
c       10
1542
 
d       10
1543
 
e       10
1544
 
f       10
1545
 
g       10
1546
 
h       10
1547
 
i       10
1548
 
drop table t1;
1549
 
create TEMPORARY table t1 (a char(10), unique (a));
1550
 
insert into t1 values ('a   ');
1551
 
insert into t1 values ('a ');
1552
 
ERROR 23000: Duplicate entry 'a ' for key 'a'
1553
 
alter table t1 modify a varchar(10);
1554
 
insert into t1 values ('a '),('a  '),('a   '),('a         ');
1555
 
ERROR 23000: Duplicate entry 'a ' for key 'a'
1556
 
insert into t1 values ('a     ');
1557
 
ERROR 23000: Duplicate entry 'a     ' for key 'a'
1558
 
insert into t1 values ('a          ');
1559
 
ERROR 23000: Duplicate entry 'a         ' for key 'a'
1560
 
insert into t1 values ('a ');
1561
 
ERROR 23000: Duplicate entry 'a ' for key 'a'
1562
 
update t1 set a='a  ' where a like 'a%';
1563
 
select concat(a,'.') from t1;
1564
 
concat(a,'.')
1565
 
a  .
1566
 
update t1 set a='abc    ' where a like 'a ';
1567
 
select concat(a,'.') from t1;
1568
 
concat(a,'.')
1569
 
a  .
1570
 
update t1 set a='a      ' where a like 'a %';
1571
 
select concat(a,'.') from t1;
1572
 
concat(a,'.')
1573
 
a      .
1574
 
update t1 set a='a  ' where a like 'a      ';
1575
 
select concat(a,'.') from t1;
1576
 
concat(a,'.')
1577
 
a  .
1578
 
drop table t1;
1579
 
create TEMPORARY table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5)));
1580
 
show create table t1;
1581
 
Table   Create Table
1582
 
t1      CREATE TEMPORARY TABLE `t1` (
1583
 
  `v` varchar(10) DEFAULT NULL,
1584
 
  `c` varchar(10) DEFAULT NULL,
1585
 
  `t` text,
1586
 
  KEY `v` (`v`(5)),
1587
 
  KEY `c` (`c`(5)),
1588
 
  KEY `t` (`t`(5))
1589
 
) ENGINE=MyISAM
1590
 
drop table t1;
1591
 
create TEMPORARY table t1 (v char(10));
1592
 
show create table t1;
1593
 
Table   Create Table
1594
 
t1      CREATE TEMPORARY TABLE `t1` (
1595
 
  `v` varchar(10) DEFAULT NULL
1596
 
) ENGINE=MyISAM
1597
 
drop table t1;
1598
 
create TEMPORARY table t1 (v varchar(10), c char(10));
1599
 
show create table t1;
1600
 
Table   Create Table
1601
 
t1      CREATE TEMPORARY TABLE `t1` (
1602
 
  `v` varchar(10) DEFAULT NULL,
1603
 
  `c` varchar(10) DEFAULT NULL
1604
 
) ENGINE=MyISAM
1605
 
insert into t1 values('a','a'),('a ','a ');
1606
 
select concat('*',v,'*',c,'*') from t1;
1607
 
concat('*',v,'*',c,'*')
1608
 
*a*a*
1609
 
*a *a *
1610
 
drop table t1;
1611
 
create TEMPORARY table t1(a int, b varchar(12), key ba(b, a));
1612
 
insert into t1 values (1, 'A'), (20, NULL);
1613
 
explain select * from t1 where a=20 and b is null;
1614
 
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
1615
 
1       SIMPLE  t1      ref     ba      ba      56      const,const     1       Using where; Using index
1616
 
select * from t1 where a=20 and b is null;
1617
 
a       b
1618
 
20      NULL
1619
 
drop table t1;
1620
 
create TEMPORARY table t1 (a char(1), b char(1), key(a, b)) engine=MyISAM;
1621
 
insert into t1 values ('8', '6'), ('4', '7');
1622
 
select min(a) from t1;
1623
 
min(a)
1624
 
4
1625
 
select min(b) from t1 where a='8';
1626
 
min(b)
1627
 
6
1628
 
drop table t1;
1629
 
create TEMPORARY table t1 ( `a` int NOT NULL auto_increment, `b` int default NULL,PRIMARY KEY  (`a`),UNIQUE KEY `b` (`b`)) ENGINE=MyISAM;
1630
 
insert into t1 (b) values (1);
1631
 
replace into t1 (b) values (2), (1), (3);
1632
 
select * from t1;
1633
 
a       b
1634
 
3       1
1635
 
2       2
1636
 
4       3
1637
 
truncate table t1;
1638
 
insert into t1 (b) values (1);
1639
 
replace into t1 (b) values (2);
1640
 
replace into t1 (b) values (1);
1641
 
replace into t1 (b) values (3);
1642
 
select * from t1;
1643
 
a       b
1644
 
3       1
1645
 
2       2
1646
 
4       3
1647
 
drop table t1;
1648
 
create TEMPORARY table t1 (rowid int not null auto_increment, val int not null,primary
1649
 
key (rowid), unique(val)) engine=MyISAM;
1650
 
replace into t1 (val) values ('1'),('2');
1651
 
replace into t1 (val) values ('1'),('2');
1652
 
insert into t1 (val) values ('1'),('2');
1653
 
ERROR 23000: Duplicate entry '1' for key 'val'
1654
 
select * from t1;
1655
 
rowid   val
1656
 
3       1
1657
 
4       2
1658
 
drop table t1;
1659
 
create TEMPORARY table t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=MyISAM;
1660
 
INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
1661
 
SELECT GRADE  FROM t1 WHERE GRADE > 160 AND GRADE < 300;
1662
 
GRADE
1663
 
252
1664
 
SELECT GRADE  FROM t1 WHERE GRADE= 151;
1665
 
GRADE
1666
 
151
1667
 
DROP TABLE t1;
1668
 
create TEMPORARY table t1(a date) engine=MyISAM;
1669
 
create TEMPORARY table t2(a date, key(a)) engine=MyISAM;
1670
 
insert into t1 values('2005-10-01');
1671
 
insert into t2 values('2005-10-01');
1672
 
select * from t1, t2
1673
 
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
1674
 
a       a
1675
 
2005-10-01      2005-10-01
1676
 
drop table t1, t2;
1677
 
create TEMPORARY table t1 (id int not null, f_id int not null, f int not null,
1678
 
primary key(f_id, id)) engine=MyISAM;
1679
 
create TEMPORARY table t2 (id int not null,s_id int not null,s varchar(200),
1680
 
primary key(id)) engine=MyISAM;
1681
 
INSERT INTO t1 VALUES (8, 1, 3);
1682
 
INSERT INTO t1 VALUES (1, 2, 1);
1683
 
INSERT INTO t2 VALUES (1, 0, '');
1684
 
INSERT INTO t2 VALUES (8, 1, '');
1685
 
commit;
1686
 
select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
1687
 
where mm.id is null lock in share mode;
1688
 
id      f_id    f
1689
 
drop table t1,t2;
1690
 
create TEMPORARY table t1 ( a int ) ENGINE=MyISAM;
1691
 
BEGIN;
1692
 
INSERT INTO t1 VALUES (1);
1693
 
ALTER TABLE t1 ENGINE=MyISAM;
1694
 
DROP TABLE t1;