| 1 |
drop table if exists t1, t2; |
| 2 |
CREATE TABLE t1 ( |
| 3 |
a int PRIMARY KEY |
| 4 |
) engine = ndb; |
| 5 |
INSERT INTO t1 VALUES (1); |
| 6 |
INSERT INTO t1 VALUES (2); |
| 7 |
INSERT INTO t1 VALUES (3); |
| 8 |
INSERT INTO t1 VALUES (4); |
| 9 |
INSERT INTO t1 VALUES (5); |
| 10 |
INSERT INTO t1 VALUES (6); |
| 11 |
select MAX(a) from t1; |
| 12 |
MAX(a) |
| 13 |
6 |
| 14 |
select MAX(a) from t1; |
| 15 |
MAX(a) |
| 16 |
6 |
| 17 |
select MAX(a) from t1; |
| 18 |
MAX(a) |
| 19 |
6 |
| 20 |
select MAX(a) from t1; |
| 21 |
MAX(a) |
| 22 |
6 |
| 23 |
select MIN(a) from t1; |
| 24 |
MIN(a) |
| 25 |
1 |
| 26 |
select MIN(a) from t1; |
| 27 |
MIN(a) |
| 28 |
1 |
| 29 |
select MIN(a) from t1; |
| 30 |
MIN(a) |
| 31 |
1 |
| 32 |
select * from t1 order by a; |
| 33 |
a |
| 34 |
1 |
| 35 |
2 |
| 36 |
3 |
| 37 |
4 |
| 38 |
5 |
| 39 |
6 |
| 40 |
select MIN(a) from t1; |
| 41 |
MIN(a) |
| 42 |
1 |
| 43 |
select MAX(a) from t1; |
| 44 |
MAX(a) |
| 45 |
6 |
| 46 |
select MAX(a) from t1; |
| 47 |
MAX(a) |
| 48 |
6 |
| 49 |
select * from t1 order by a; |
| 50 |
a |
| 51 |
1 |
| 52 |
2 |
| 53 |
3 |
| 54 |
4 |
| 55 |
5 |
| 56 |
6 |
| 57 |
drop table t1; |
| 58 |
CREATE TABLE t2 ( |
| 59 |
a int PRIMARY KEY, |
| 60 |
b int not null, |
| 61 |
c int not null, |
| 62 |
KEY(b), |
| 63 |
UNIQUE(c) |
| 64 |
) engine = ndb; |
| 65 |
INSERT INTO t2 VALUES (1, 5, 1); |
| 66 |
INSERT INTO t2 VALUES (2, 2, 7); |
| 67 |
INSERT INTO t2 VALUES (3, 3, 3); |
| 68 |
INSERT INTO t2 VALUES (4, 4, 4); |
| 69 |
INSERT INTO t2 VALUES (5, 5, 5); |
| 70 |
INSERT INTO t2 VALUES (6, 6, 6); |
| 71 |
INSERT INTO t2 VALUES (7, 2, 10); |
| 72 |
INSERT INTO t2 VALUES (8, 10, 2); |
| 73 |
select MAX(a) from t2; |
| 74 |
MAX(a) |
| 75 |
8 |
| 76 |
select MAX(b) from t2; |
| 77 |
MAX(b) |
| 78 |
10 |
| 79 |
select MAX(c) from t2; |
| 80 |
MAX(c) |
| 81 |
10 |
| 82 |
select MIN(a) from t2; |
| 83 |
MIN(a) |
| 84 |
1 |
| 85 |
select MIN(b) from t2; |
| 86 |
MIN(b) |
| 87 |
2 |
| 88 |
select MIN(c) from t2; |
| 89 |
MIN(c) |
| 90 |
1 |
| 91 |
select * from t2 order by a; |
| 92 |
a b c |
| 93 |
1 5 1 |
| 94 |
2 2 7 |
| 95 |
3 3 3 |
| 96 |
4 4 4 |
| 97 |
5 5 5 |
| 98 |
6 6 6 |
| 99 |
7 2 10 |
| 100 |
8 10 2 |
| 101 |
select MIN(b) from t2; |
| 102 |
MIN(b) |
| 103 |
2 |
| 104 |
select MAX(a) from t2; |
| 105 |
MAX(a) |
| 106 |
8 |
| 107 |
select MAX(c) from t2; |
| 108 |
MAX(c) |
| 109 |
10 |
| 110 |
select * from t2 order by a; |
| 111 |
a b c |
| 112 |
1 5 1 |
| 113 |
2 2 7 |
| 114 |
3 3 3 |
| 115 |
4 4 4 |
| 116 |
5 5 5 |
| 117 |
6 6 6 |
| 118 |
7 2 10 |
| 119 |
8 10 2 |
| 120 |
drop table t2; |