| 1 |
create table t1 ( |
| 2 |
th int primary key, |
| 3 |
un int, |
| 4 |
de int, |
| 5 |
rb varchar(1000) character set latin1, |
| 6 |
al longtext, |
| 7 |
key(de), |
| 8 |
unique(rb)) |
| 9 |
engine=ndb; |
| 10 |
insert into t1 values (1, 1, 1, repeat('O', 1000), repeat('L', 60000)); |
| 11 |
insert into t1 values (2, 2, 2, repeat('W', 999), repeat('B', 60001)); |
| 12 |
insert into t1 values (3, 3, 3, repeat('P', 998), repeat('P', 60002)); |
| 13 |
insert into t1 values (4, 4, 4, repeat('Q', 997), repeat('E', 60003)); |
| 14 |
insert into t1 values (5, 5, 5, repeat('E', 996), repeat('A', 60004)); |
| 15 |
select th, un, de, length(rb), length(al) |
| 16 |
from t1 |
| 17 |
where th in (2,4) |
| 18 |
order by th; |
| 19 |
th un de length(rb) length(al) |
| 20 |
2 2 2 999 60001 |
| 21 |
4 4 4 997 60003 |
| 22 |
select th, un, de, length(rb), length(al) |
| 23 |
from t1 |
| 24 |
where rb |
| 25 |
in (repeat('O', 1000), repeat('Q', 997)) |
| 26 |
order by th; |
| 27 |
th un de length(rb) length(al) |
| 28 |
1 1 1 1000 60000 |
| 29 |
4 4 4 997 60003 |
| 30 |
select th, un, de, length(rb), length(al) |
| 31 |
from t1 |
| 32 |
where de between 3 and 5 |
| 33 |
order by th; |
| 34 |
th un de length(rb) length(al) |
| 35 |
3 3 3 998 60002 |
| 36 |
4 4 4 997 60003 |
| 37 |
5 5 5 996 60004 |
| 38 |
select th, un, de, length(rb), length(al) |
| 39 |
from t1 |
| 40 |
order by th; |
| 41 |
th un de length(rb) length(al) |
| 42 |
1 1 1 1000 60000 |
| 43 |
2 2 2 999 60001 |
| 44 |
3 3 3 998 60002 |
| 45 |
4 4 4 997 60003 |
| 46 |
5 5 5 996 60004 |
| 47 |
update t1 |
| 48 |
set un=6, de=6, rb= repeat('S', 995), al = repeat('O', 60005) |
| 49 |
where th = 1; |
| 50 |
update t1 |
| 51 |
set un=7, de=7, al = repeat('F', 60006) |
| 52 |
where rb = repeat('W', 999); |
| 53 |
update t1 |
| 54 |
set un= un + 5, rb = repeat('U', 1000 - un), al = repeat('U', 60000 + un) |
| 55 |
where de >= 3 and de <= 5; |
| 56 |
select th, un, de, length(rb), length(al) |
| 57 |
from t1 |
| 58 |
order by th; |
| 59 |
th un de length(rb) length(al) |
| 60 |
1 6 6 995 60005 |
| 61 |
2 7 7 999 60006 |
| 62 |
3 8 3 992 60008 |
| 63 |
4 9 4 991 60009 |
| 64 |
5 10 5 990 60010 |
| 65 |
alter table t1 add column extra varchar(2000); |
| 66 |
Warnings: |
| 67 |
Warning 1478 Converted FIXED field 'extra' to DYNAMIC to enable online ADD COLUMN |
| 68 |
update t1 set extra = repeat(rb, 2); |
| 69 |
select th, un, de, length(rb), length(al), length(extra) |
| 70 |
from t1 |
| 71 |
order by th; |
| 72 |
th un de length(rb) length(al) length(extra) |
| 73 |
1 6 6 995 60005 1990 |
| 74 |
2 7 7 999 60006 1998 |
| 75 |
3 8 3 992 60008 1984 |
| 76 |
4 9 4 991 60009 1982 |
| 77 |
5 10 5 990 60010 1980 |
| 78 |
select th, un, de, length(rb), length(al), length(extra) |
| 79 |
from t1 |
| 80 |
where extra in ( |
| 81 |
repeat('U', 2000), |
| 82 |
repeat('U', 1998), |
| 83 |
repeat('U', 1996), |
| 84 |
repeat('U', 1994), |
| 85 |
repeat('U', 1992), |
| 86 |
repeat('U', 1990), |
| 87 |
repeat('U', 1988), |
| 88 |
repeat('U', 1986), |
| 89 |
repeat('U', 1984), |
| 90 |
repeat('U', 1982), |
| 91 |
repeat('U', 1980), |
| 92 |
repeat('U', 1978), |
| 93 |
repeat('U', 1976), |
| 94 |
repeat('U', 1974), |
| 95 |
repeat('U', 1972), |
| 96 |
repeat('U', 1970), |
| 97 |
repeat('U', 1968), |
| 98 |
repeat('U', 1966), |
| 99 |
repeat('U', 1964)) |
| 100 |
order by th; |
| 101 |
th un de length(rb) length(al) length(extra) |
| 102 |
3 8 3 992 60008 1984 |
| 103 |
4 9 4 991 60009 1982 |
| 104 |
5 10 5 990 60010 1980 |
| 105 |
drop table t1; |