mariadb/mysql-test/t/ndb_minmax.test

65 lines
1.3 KiB
Text

-- source include/have_ndb.inc
-- source include/not_embedded.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
CREATE TABLE t1 (
a int PRIMARY KEY
) engine = ndb;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
INSERT INTO t1 VALUES (6);
select MAX(a) from t1;
select MAX(a) from t1;
select MAX(a) from t1;
select MAX(a) from t1;
select MIN(a) from t1;
select MIN(a) from t1;
select MIN(a) from t1;
select * from t1 order by a;
select MIN(a) from t1;
select MAX(a) from t1;
select MAX(a) from t1;
select * from t1 order by a;
drop table t1;
CREATE TABLE t2 (
a int PRIMARY KEY,
b int not null,
c int not null,
KEY(b),
UNIQUE(c)
) engine = ndb;
INSERT INTO t2 VALUES (1, 5, 1);
INSERT INTO t2 VALUES (2, 2, 7);
INSERT INTO t2 VALUES (3, 3, 3);
INSERT INTO t2 VALUES (4, 4, 4);
INSERT INTO t2 VALUES (5, 5, 5);
INSERT INTO t2 VALUES (6, 6, 6);
INSERT INTO t2 VALUES (7, 2, 10);
INSERT INTO t2 VALUES (8, 10, 2);
select MAX(a) from t2;
select MAX(b) from t2;
select MAX(c) from t2;
select MIN(a) from t2;
select MIN(b) from t2;
select MIN(c) from t2;
select * from t2 order by a;
select MIN(b) from t2;
select MAX(a) from t2;
select MAX(c) from t2;
select * from t2 order by a;
drop table t2;
# End of 4.1 tests