1
drop table if exists t1;
2
create table t1 (a int, b int, primary key (a));
3
insert into t1(a,b) values(1,1),(2,1),(3,1),(4,1);
4
update t1 set b=2 where a>0;
11
update t1 set b=3 where a<5;
18
update t1 set b=4 where a>1;
19
update t1 set b=5 where a<4;
26
update t1 set b=6 where a>=1;
33
update t1 set b=7 where a<=5;
40
update t1 set b=8 where a>0 and a<2;
41
update t1 set b=9 where a>=2 and a<3;
42
update t1 set b=10 where a>=3 and a<=4;
49
update t1 set b=11 where a=1 or a=2 or a=3 or a=4;
56
replace into t1(a,b) values(1,1),(2,2),(3,3),(4,4);
57
update t1 set b=b+1 where b>0;
64
update t1 set b=b-1 where b<6;
71
update t1 set b=5 where b>1;
72
update t1 set b=6 where b<5;
79
update t1 set b=7 where b>=1;
86
update t1 set b=8 where b<=7;
93
replace into t1(a,b) values(1,1),(2,2),(3,3),(4,4);
94
update t1 set b=10 where b>0 and b<2;
95
update t1 set b=11 where b>=2 and b<3;
96
update t1 set b=12 where b>=3 and b<=4;
103
replace into t1(a,b) values(1,1),(2,2),(3,3),(4,4);
104
update t1 set b=11 where b=1 or b=2 or b=3 or b=4;
111
drop table if exists t1;
112
create table t1(a int, b int, c int, primary key(a));
113
replace into t1(a,b) values(1,1),(2,2),(3,1),(4,2);
114
update t1 set c=1 where a>0 and b>1;
115
update t1 set c=2 where a<5 and b<2;
122
update t1 set c=3 where a>=0 and b<=1;
123
update t1 set c=4 where a<=5 and b>=2;
130
update t1 set c=5 where a=0 or a=1 or a=2 or b=1;
131
update t1 set c=6 where b=2 or a=1 or a=2;
138
replace into t1(a,b,c) values(1,1,NULL),(2,2,NULL),(3,3,NULL),(4,4,NULL);
139
update t1 set c=1 where a<=1 or b>=4;
140
update t1 set c=2 where a>1 or b<4;
147
drop table if exists t1;
148
create table t1(a int, b int, c int, d int, primary key(a,b));
149
insert into t1(a,b,c,d) values(1,1,1,1),(2,2,1,1),(3,3,1,1);
150
update t1 set c=c+1, d=d+1 where (a,b) > (0,0);
156
update t1 set c=c+1, d=d+1 where (a,b) < (4,4);
162
update t1 set c=c+1, d=d+1 where (a,b) >= (1,1);
168
update t1 set c=c+1, d=d+1 where (a,b) <= (1,1);
174
update t1 set c=c+1, d=d+1 where (a,b) in ((NULL,NULL),(0,0),(1,1),(2,2),(3,3),(4,4));
180
update t1 set c=c+1, d=d+1 where (a,b)=(1,1) or (a,b)=(2,2) or (a,b)=(3,3);
186
update t1 set c=1, d=1 where (a,b) in ((1,1),(2,2),(3,3));
187
update t1 set c=c+1, d=d+1 where (a,b,c,d) >= (1,1,1,1);
193
update t1 set c=c+1, d=d+1 where (a,b,c,d) <= (3,3,3,3);
199
update t1 set c=c+1, d=d+1 where (a,b,c,d)=(1,1,1,1) or (a,b,c,d)=(2,2,1,1) or (a,b,c,d)=(3,3,3,3);
205
drop table if exists t1;
206
create table t1(a int, b int, c int, d int, primary key(a,b));
207
insert into t1(a,b,c,d) values(1,1,1,1),(1,2,1,1),(1,3,1,1);
208
update t1 set c=c+1, d=d+1 where a = 1;
214
update t1 set c=c+1, d=d+1 where a > 0;
215
update t1 set c=c+1, d=d+1 where a >=1 ;
221
update t1 set c=c+1, d=d+1 where a < 4;
227
update t1 set c=c+1, d=d+1 where a <= 1;
233
update t1 set c=c+1, d=d+1 where a=1 or a=2 or a=3;
239
update t1 set c=c+1, d=d+1 where (a=1 or a=2 or a=3) and (b=1 or b=2);
245
update t1 set c=c+1, d=d+1 where a>=1 and b>=2;
251
drop table if exists t1;
252
create table t1(a int, b int, c int, d int, primary key(a,b));
253
replace into t1(a,b,c,d) values(1,1,1,1),(2,2,2,1),(3,3,3,1);
254
update t1 set d=d+1 where (a,b)>=(1,1) and c=1;
260
update t1 set d=d+1 where (a,b)>=(1,1) and c=3;
266
update t1 set d=d+1 where (a=1 or a=2 or a=3) and c>=1;
272
update t1 set d=d+1 where (a=1 or a=2 or a=3) and c<1;
278
update t1 set d=d+1 where (a=1 or a=2 or a=3) and (b=2 or b=3);
284
update t1 set d=d+1 where (a=1 or a=2 or a=3) and (b=2 or b=3) and c=3;
290
update t1 set c=c+1, d=d+1 where a>=0 and a<=3 and b>1 and b<3;
296
update t1 set c=c+1, d=d+1 where (c,d)>=(1,1);
302
update t1 set c=c+1, d=d+1 where (b,a) > (1,1);
308
drop table if exists t1, t2, t3;
309
create table t1(a int, b int, c int, d int, primary key(a,b,c));
310
insert into t1(a,b,c) values (1,1,1),(2,2,2),(3,3,3);
311
update t1 set d=1 where (a,b,c)>(0,0,0) and (a,b,c)<=(3,3,3);
317
create table t2(a varchar(1024), b varchar(1024), c varchar(1024), d varchar(1024), primary key(a,b,c));
318
insert into t2(a,b,c) values ('a','a','a'),('b','b','b'),('c','c','c');
319
update t2 set d='a' where (a,b,c)>=('a','a','b') and (a,b,c)<('b','b','c');
325
create table t3(a int, b varchar(1024), c timestamp(6) default "2012-01-01 12:00:00", d int, primary key(a,b,c));
326
insert into t3(a,b,c) values (1,'a','2014-02-17'),(2,'b','2014-02-17'),(3,'c','2014-02-18');
327
update t3 set d=1 where (a,b,c)>=(1,'a','2014-02-17 00:00:00') and (a,b,c)<=(2,'b','2014-02-18');
330
1 a 2014-02-17 00:00:00.000000 1
331
2 b 2014-02-17 00:00:00.000000 1
332
3 c 2014-02-18 00:00:00.000000 NULL
333
drop table if exists t1, t2, t3;