71
CREATE TEMPORARY TABLE t1 (
72
72
lfdnr int NOT NULL default '0',
73
73
ticket int NOT NULL default '0',
74
74
client varchar(255) NOT NULL default '',
75
75
replyto varchar(255) NOT NULL default '',
76
76
subject varchar(100) NOT NULL default '',
77
timestamp_arg int NOT NULL default '0',
77
timestamp int NOT NULL default '0',
78
78
tstamp timestamp NOT NULL,
79
79
status int NOT NULL default '0',
80
80
type varchar(15) NOT NULL default '',
141
141
insert into t2 values (1,1),(1,2),(1,3);
142
142
update t1 set b=(select distinct 1 from (select * from t2) a);
143
143
drop table t1,t2;
144
CREATE TEMPORARY TABLE t1 (
145
145
`id_param` int NOT NULL default '0',
146
146
`nom_option` char(40) NOT NULL default '',
147
147
`valid` int NOT NULL default '0',
153
153
id_param nom_option valid
156
create table t1 (F1 VARCHAR(30), F2 VARCHAR(30), F3 VARCHAR(30), cnt int, groupid int, KEY groupid_index (groupid));
157
insert into t1 (F1,F2,F3,cnt,groupid) values ('0','0','0',1,6),
158
('0','1','2',1,5), ('0','2','0',1,3), ('1','0','1',1,2),
159
('1','2','1',1,1), ('1','2','2',1,1), ('2','0','1',2,4),
161
delete from m1 using t1 m1,t1 m2 where m1.groupid=m2.groupid and (m1.cnt < m2.cnt or m1.cnt=m2.cnt and m1.F3>m2.F3);
172
create table t1 (c1 int, c2 char(6), c3 int);
173
create table t2 (c1 int, c2 char(6));
174
insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20);
175
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1";
176
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10;
156
178
create table t1 (id int not null auto_increment primary key, id_str varchar(32));
157
179
insert into t1 (id_str) values ("test");
158
180
update t1 set id_str = concat(id_str, id) where id = last_insert_id();
192
create table t1 (a int, b varchar(10), key b(b(5))) engine=myisam;
193
create table t2 (a int, b varchar(10)) engine=myisam;
194
insert into t1 values ( 1, 'abcd1e');
195
insert into t1 values ( 2, 'abcd2e');
196
insert into t2 values ( 1, 'abcd1e');
197
insert into t2 values ( 2, 'abcd2e');
199
Table Op Msg_type Msg_text
200
test.t1 analyze status OK
201
test.t2 analyze status OK
202
update t1, t2 set t1.a = t2.a where t2.b = t1.b;
170
206
create table t1(f1 int, f2 int);
171
207
create table t2(f3 int, f4 int);
172
208
create index idx on t2(f3);
199
235
show status like 'handler_read%';
200
236
Variable_name Value
206
Handler_read_rnd_next #
242
Handler_read_rnd_next 0
208
244
update t1 set a=9999 order by a limit 1;
209
245
update t1 set b=9999 order by a limit 1;
210
246
show status like 'handler_read%';
211
247
Variable_name Value
217
Handler_read_rnd_next #
253
Handler_read_rnd_next 18
219
255
delete from t1 order by a limit 1;
220
256
show status like 'handler_read%';
221
257
Variable_name Value
227
Handler_read_rnd_next #
263
Handler_read_rnd_next 9
229
265
delete from t1 order by a desc limit 1;
230
266
show status like 'handler_read%';
231
267
Variable_name Value
237
Handler_read_rnd_next #
273
Handler_read_rnd_next 8
238
274
alter table t1 disable keys;
240
276
Note 1031 Table storage engine for 't1' doesn't have this option
313
create table t1 (f1 int);
314
create table t2 (f2 int);
315
insert into t1 values(1),(2);
316
insert into t2 values(1),(1);
317
update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
319
info: Rows matched: 3 Changed: 3 Warnings: 0
321
update t1 set f1=1 where f1=3;
322
update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
324
info: Rows matched: 3 Changed: 3 Warnings: 0
277
326
create table t1 (a int);
278
327
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
279
328
create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
280
insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A CROSS JOIN t1 B;
329
insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B;
282
331
update t2 set a=3 where a=2;
283
332
show status like 'handler_read%';
284
333
Variable_name Value
290
Handler_read_rnd_next #
339
Handler_read_rnd_next 0
291
340
drop table t1, t2;
292
341
create table t1(f1 int, `*f2` int);
293
342
insert into t1 values (1,1);
320
369
show status like '%Handler_read%';
321
370
Variable_name Value
327
Handler_read_rnd_next #
376
Handler_read_rnd_next 0
328
377
SELECT user_id FROM t1 WHERE request_id=999999999999999999999999999999;
330
379
show status like '%Handler_read%';
331
380
Variable_name Value
337
Handler_read_rnd_next #
386
Handler_read_rnd_next 0
338
387
UPDATE t1 SET user_id=null WHERE request_id=9999999999999;
339
388
show status like '%Handler_read%';
340
389
Variable_name Value
346
Handler_read_rnd_next #
395
Handler_read_rnd_next 0
347
396
UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999;
349
Warning 1264 Out of range value for column 'request_id' at row 1
350
Warning 1264 Out of range value for column 'request_id' at row 1
351
397
show status like '%Handler_read%';
352
398
Variable_name Value
358
Handler_read_rnd_next #
404
Handler_read_rnd_next 0
360
406
CREATE TABLE t1 (
395
444
select count(*) from t1 join t2 on (t1.a=t2.a);
447
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
449
info: Rows matched: 128 Changed: 0 Warnings: 0
398
450
update t1 set a=1;
399
451
update t2 set a=1;
400
452
select count(*) from t1 join t2 on (t1.a=t2.a);
455
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
457
info: Rows matched: 128 Changed: 127 Warnings: 0
403
458
drop table t1,t2;
404
CREATE TABLE t1(col1 enum('a','b') NOT NULL, col2 enum('a','b') DEFAULT NULL, KEY col2 (col2));
405
UPDATE t1 SET col1 = "crash" WHERE col2 = now() ;