1
1
drop table if exists t1,t2,t3,t11,t12;
2
CREATE TABLE t1 (a int, b int);
2
CREATE TABLE t1 (a tinyint, b tinyint);
3
3
INSERT INTO t1 VALUES (1,1);
4
INSERT INTO t1 VALUES (1,2);
4
INSERT LOW_PRIORITY INTO t1 VALUES (1,2);
5
5
INSERT INTO t1 VALUES (1,3);
6
6
DELETE from t1 where a=1 limit 1;
7
DELETE from t1 where a=1;
7
DELETE LOW_PRIORITY from t1 where a=1;
8
8
INSERT INTO t1 VALUES (1,1);
10
11
INSERT INTO t1 VALUES (1,2);
12
14
INSERT INTO t1 VALUES (1,2);
162
185
CREATE TABLE t1 (
164
`seq` int NOT NULL auto_increment,
188
`seq` int unsigned NOT NULL auto_increment,
165
189
PRIMARY KEY (`seq`),
166
190
KEY `seq` (`seq`),
167
192
KEY `date` (`date`)
169
DELETE FROM t1 ORDER BY date ASC LIMIT 1;
194
DELETE FROM t1 ORDER BY date ASC, time ASC LIMIT 1;
197
CREATE TABLE t1 (a int not null,b int not null);
198
CREATE TABLE t2 (a int not null, b int not null, primary key (a,b));
199
CREATE TABLE t3 (a int not null, b int not null, primary key (a,b));
200
insert into t1 values (1,1),(2,1),(1,3);
201
insert into t2 values (1,1),(2,2),(3,3);
202
insert into t3 values (1,1),(2,1),(1,3);
203
select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
208
explain select * from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
209
id select_type table type possible_keys key key_len ref rows Extra
210
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
211
1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a 1 Using index
212
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b,test.t1.b 1 Using index
213
delete t2.*,t3.* from t1,t2,t3 where t1.a=t2.a AND t2.b=t3.a and t1.b=t3.b;
217
create table t1(a date not null);
218
insert into t1 values (0);
219
select * from t1 where a is null;
222
delete from t1 where a is null;
223
select count(*) from t1;
172
227
CREATE TABLE t1 (a INT);
173
228
INSERT INTO t1 VALUES (1);
174
229
DELETE FROM t1 ORDER BY x;
196
251
INSERT INTO db2.t1 (a) SELECT * FROM t2;
252
DELETE FROM t1 alias USING t1, t2 alias WHERE t1.a = alias.a;
253
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING t1, t2 alias WHERE t1.a = alias.a' at line 1
254
DELETE FROM alias USING t1, t2 alias WHERE t1.a = alias.a;
255
DELETE FROM t1, alias USING t1, t2 alias WHERE t1.a = alias.a;
256
DELETE FROM t1, t2 USING t1, t2 alias WHERE t1.a = alias.a;
257
ERROR 42S02: Unknown table 't2' in MULTI DELETE
258
DELETE FROM db1.t1 alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
259
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a' at line 1
260
DELETE FROM alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
261
DELETE FROM db2.alias USING db1.t1, db2.t1 alias WHERE db1.t1.a = alias.a;
262
ERROR 42S02: Unknown table 'alias' in MULTI DELETE
263
DELETE FROM t1 USING t1 WHERE a = 1;
197
264
SELECT * FROM t1;
199
266
DELETE FROM t1 alias USING t1 alias WHERE a = 2;
200
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'alias USING t1 alias WHERE a = 2' at line 1
267
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'alias USING t1 alias WHERE a = 2' at line 1
201
268
SELECT * FROM t1;
203
270
DROP TABLE t1, t2;
219
286
CREATE TABLE db2.t2 AS SELECT * FROM db2.t1;
220
287
CREATE TABLE t1 AS SELECT * FROM db2.t2;
221
288
CREATE TABLE t2 AS SELECT * FROM t1;
293
ERROR 3D000: No database selected
294
DELETE a1,a2 FROM db1.t1, db2.t2;
295
ERROR 3D000: No database selected
296
DELETE a1,a2 FROM db1.t1, db2.t2;
297
ERROR 3D000: No database selected
298
DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
299
ERROR 3D000: No database selected
300
DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
301
ERROR 3D000: No database selected
302
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
303
ERROR 3D000: No database selected
304
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
305
ERROR 3D000: No database selected
306
DELETE FROM a1,a2 USING db1.t1, db2.t2;
307
ERROR 3D000: No database selected
308
DELETE FROM a1,a2 USING db1.t1, db2.t2;
309
ERROR 3D000: No database selected
310
DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
311
ERROR 3D000: No database selected
312
DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
313
ERROR 3D000: No database selected
314
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
315
ERROR 3D000: No database selected
316
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
317
ERROR 3D000: No database selected
318
DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
319
ERROR 3D000: No database selected
320
DELETE a1 FROM db1.a1, db2.t2 AS a1;
321
ERROR 3D000: No database selected
322
DELETE a1 FROM a1, db1.t1 AS a1;
323
ERROR 3D000: No database selected
324
DELETE t1 FROM db1.t1, db2.t1 AS a1;
325
ERROR 3D000: No database selected
326
DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
327
ERROR 3D000: No database selected
328
DELETE t1 FROM db1.t1, db2.t1;
329
ERROR 3D000: No database selected
331
DELETE a1,a2 FROM db1.t1, db2.t2;
332
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
333
DELETE a1,a2 FROM db1.t1, db2.t2;
334
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
335
DELETE a1,a2 FROM db1.t1 AS a1, db2.t2;
336
ERROR 42S02: Unknown table 'a2' in MULTI DELETE
337
DELETE a1,a2 FROM db1.t1, db2.t2 AS a2;
338
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
339
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
340
ERROR 42S02: Table 'db3.t1' doesn't exist
341
DELETE a1,a2 FROM db3.t1 AS a1, db4.t2 AS a2;
342
ERROR 42S02: Table 'db3.t1' doesn't exist
343
DELETE FROM a1,a2 USING db1.t1, db2.t2;
344
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
345
DELETE FROM a1,a2 USING db1.t1, db2.t2;
346
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
347
DELETE FROM a1,a2 USING db1.t1 AS a1, db2.t2;
348
ERROR 42S02: Unknown table 'a2' in MULTI DELETE
349
DELETE FROM a1,a2 USING db1.t1, db2.t2 AS a2;
350
ERROR 42S02: Unknown table 'a1' in MULTI DELETE
351
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
352
ERROR 42S02: Table 'db3.t1' doesn't exist
353
DELETE FROM a1,a2 USING db3.t1 AS a1, db4.t2 AS a2;
354
ERROR 42S02: Table 'db3.t1' doesn't exist
355
DELETE a1 FROM db1.t1 AS a1, db2.t2 AS a1;
356
ERROR 42000: Not unique table/alias: 'a1'
357
DELETE a1 FROM db1.a1, db2.t2 AS a1;
358
ERROR 42S02: Table 'db1.a1' doesn't exist
359
DELETE a1 FROM a1, db1.t1 AS a1;
360
ERROR 42000: Not unique table/alias: 'a1'
361
DELETE t1 FROM db1.t1, db2.t1 AS a1;
362
ERROR 42S02: Unknown table 't1' in MULTI DELETE
363
DELETE t1 FROM db1.t1 AS a1, db2.t1 AS a2;
364
ERROR 42S02: Unknown table 't1' in MULTI DELETE
365
DELETE t1 FROM db1.t1, db2.t1;
366
ERROR 42S02: Unknown table 't1' in MULTI DELETE
367
DELETE t1 FROM db1.t2 AS t1, db2.t2 AS t2 WHERE t2.a = 1 AND t1.a = t2.a;
371
DELETE a1, a2 FROM db2.t1 AS a1, t2 AS a2 WHERE a1.a = 2 AND a2.a = 2;
222
375
DROP DATABASE db1;
223
376
DROP DATABASE db2;
224
377
DROP TABLE t1, t2;