1
drop table if exists t1;
2
create table t1 (a int not null default 0 primary key, b int not null default 0);
3
insert into t1 () values ();
4
insert into t1 values (1,1),(2,1),(3,1);
5
update t1 set a=4 where b=1 limit 1;
12
update t1 set b=2 where b=1 limit 2;
19
update t1 set b=4 where b=1;
26
delete from t1 where b=2 limit 1;
32
delete from t1 limit 1;
38
create table t1 (i int);
39
insert into t1 (i) values(1),(1),(1);
40
delete from t1 limit 1;
41
update t1 set i=2 limit 1;
42
delete from t1 limit 0;
43
update t1 set i=3 limit 0;
51
CREATE TABLE t1(id int auto_increment primary key, id2 int, index(id2));
52
INSERT INTO t1 (id2) values (0),(0),(0);
53
DELETE FROM t1 WHERE id=1;
54
INSERT INTO t1 SET id2=0;
60
DELETE FROM t1 WHERE id2 = 0 ORDER BY id LIMIT 1;
65
DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1;
70
create table t1 (a integer);
71
insert into t1 values (1);
72
select 1 as a from t1 union all select 1 from dual limit 1;
75
(select 1 as a from t1) union all (select 1 from dual) limit 1;
79
create table t1 (a int);
80
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
81
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
82
id select_type table type possible_keys key key_len ref rows Extra
83
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
84
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
87
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
88
id select_type table type possible_keys key key_len ref rows Extra
89
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
90
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
94
prepare s from "select 1 limit ?";
100
ERROR HY000: Incorrect arguments to EXECUTE
101
prepare s from "select 1 limit 1, ?";
103
ERROR HY000: Incorrect arguments to EXECUTE
104
prepare s from "select 1 limit ?, ?";
105
execute s using @a, @a;
106
ERROR HY000: Incorrect arguments to EXECUTE
107
set @a=14632475938453979136;
108
execute s using @a, @a;
110
set @a=-14632475938453979136;
111
execute s using @a, @a;
112
ERROR HY000: Incorrect arguments to EXECUTE