1
drop table if exists t1,t2,t3,t11,t12;
2
CREATE TABLE t1 (a int, b int);
3
INSERT INTO t1 VALUES (1,1);
4
INSERT INTO t1 VALUES (1,2);
5
INSERT INTO t1 VALUES (1,3);
6
DELETE from t1 where a=1 limit 1;
7
DELETE from t1 where a=1;
8
INSERT INTO t1 VALUES (1,1);
10
INSERT INTO t1 VALUES (1,2);
12
INSERT INTO t1 VALUES (1,2);
19
b bigint not null default 0,
20
c bigint not null default 0,
21
d bigint not null default 0,
22
e bigint not null default 0,
23
f bigint not null default 0,
24
g bigint not null default 0,
25
h bigint not null default 0,
26
i bigint not null default 0,
27
j bigint not null default 0,
28
primary key (a,b,c,d,e,f,g,h,i,j));
29
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
30
delete from t1 where a=26;
34
b bigint not null default 0,
35
c bigint not null default 0,
36
d bigint not null default 0,
37
e bigint not null default 0,
38
f bigint not null default 0,
39
g bigint not null default 0,
40
h bigint not null default 0,
41
i bigint not null default 0,
42
j bigint not null default 0,
43
primary key (a,b,c,d,e,f,g,h,i,j));
44
insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
45
delete from t1 where a=27;
48
`i` int NOT NULL default '0',
49
`i2` int NOT NULL default '0',
53
CREATE TEMPORARY TABLE t1 (
54
bool char(0) default NULL,
55
not_null varchar(20) binary NOT NULL default '',
56
misc integer not null,
57
PRIMARY KEY (not_null)
59
INSERT INTO t1 VALUES (NULL,'a',4), (NULL,'b',5), (NULL,'c',6), (NULL,'d',7);
60
select * from t1 where misc > 5 and bool is null;
64
delete from t1 where misc > 5 and bool is null;
65
select * from t1 where misc > 5 and bool is null;
67
select count(*) from t1;
70
delete from t1 where 1 > 2;
71
select count(*) from t1;
74
delete from t1 where 3 > 2;
75
select count(*) from t1;
79
create table t11 (a int NOT NULL, b int, primary key (a));
80
create table t12 (a int NOT NULL, b int, primary key (a));
81
create table t2 (a int NOT NULL, b int, primary key (a));
82
insert into t11 values (0, 10),(1, 11),(2, 12);
83
insert into t12 values (33, 10),(0, 11),(2, 12);
84
insert into t2 values (1, 21),(2, 12),(3, 23);
120
delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
121
ERROR 21000: Subquery returns more than 1 row
132
drop table t11, t12, t2;
133
create table t1 (a int, b int, unique key (a), key (b));
134
insert into t1 values (3, 3), (7, 7);
135
delete from t1 where a = 3;
137
Table Op Msg_type Msg_text
138
test.t1 check status OK
143
CREATE TABLE t1 ( a int PRIMARY KEY );
144
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
145
INSERT INTO t1 VALUES (0),(1),(2);
146
DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
152
create table t1(f1 int primary key);
153
insert into t1 values (4),(3),(1),(2);
154
delete from t1 where (@a:= f1) order by f1 limit 1;
161
`seq` int NOT NULL auto_increment,
166
DELETE FROM t1 ORDER BY date ASC LIMIT 1;
169
CREATE TABLE t1 (a INT);
170
INSERT INTO t1 VALUES (1);
171
DELETE FROM t1 ORDER BY x;
172
ERROR 42S22: Unknown column 'x' in 'order clause'
173
DELETE FROM t1 ORDER BY t2.x;
174
ERROR 42S22: Unknown column 't2.x' in 'order clause'
175
DELETE FROM t1 ORDER BY (SELECT x);
176
ERROR 42S22: Unknown column 'x' in 'field list'
185
CREATE TABLE db1.t1 (
188
INSERT INTO db1.t1 (a) SELECT * FROM t1;
190
CREATE TABLE db2.t1 (
193
INSERT INTO db2.t1 (a) SELECT * FROM t2;
196
DELETE FROM t1 alias USING t1 alias WHERE a = 2;
197
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
204
DROP DATABASE IF EXISTS db1;
205
DROP DATABASE IF EXISTS db2;
206
DROP DATABASE IF EXISTS db3;
207
DROP DATABASE IF EXISTS db4;
208
DROP TABLE IF EXISTS t1, t2;
212
CREATE TABLE db1.t1 (a INT, b INT);
213
INSERT INTO db1.t1 VALUES (1,1),(2,2),(3,3);
214
CREATE TABLE db1.t2 AS SELECT * FROM db1.t1;
215
CREATE TABLE db2.t1 AS SELECT * FROM db1.t2;
216
CREATE TABLE db2.t2 AS SELECT * FROM db2.t1;
217
CREATE TABLE t1 AS SELECT * FROM db2.t2;
218
CREATE TABLE t2 AS SELECT * FROM t1;