github.com/matrixorigin/matrixone@v0.7.0/test/distributed/cases/function/func_aggr_min.result (about) 1 SELECT min(null); 2 min(null) 3 null 4 create table t1(a tinyint, b SMALLINT, c bigint, d INT, e BIGINT, f FLOAT, g DOUBLE, h decimal(38,19), i DATE, k datetime, l TIMESTAMP, m char(255), n varchar(255)); 5 insert into t1 values(1, 1, 2, 43, 5, 35.5, 31.133, 14.314, "2012-03-10", "2012-03-12 10:03:12", "2022-03-12 13:03:12", "ab23c", "d5cf"); 6 insert into t1 values(71, 1, 2, 34, 5, 5.5, 341.13, 15.314, "2012-03-22", "2013-03-12 10:03:12", "2032-03-12 13:04:12", "abr23c", "3dcf"); 7 insert into t1 values(1, 1, 21, 4, 54, 53.5, 431.13, 14.394, "2011-03-12", "2015-03-12 10:03:12", "2002-03-12 13:03:12", "afbc", "dct5f"); 8 insert into t1 values(1, 71, 2, 34, 5, 5.5, 31.313, 124.314, "2012-01-12", "2019-03-12 10:03:12", "2013-03-12 13:03:12", "3abd1c", "dcvf"); 9 select min(a) from t1; 10 min(a) 11 1 12 select min(b) from t1; 13 min(b) 14 1 15 select min(c) from t1; 16 min(c) 17 2 18 select min(d) from t1; 19 min(d) 20 4 21 select min(e) from t1; 22 min(e) 23 5 24 select min(f) from t1; 25 min(f) 26 5.5 27 select min(g) from t1; 28 min(g) 29 31.133 30 select min(h) from t1; 31 min(h) 32 14.3140000000000000000 33 select min(i) from t1; 34 min(i) 35 2011-03-12 36 select min(k) from t1; 37 min(k) 38 2012-03-12 10:03:12 39 select min(l) from t1; 40 min(l) 41 2002-03-12 13:03:12 42 select min(m) from t1; 43 min(m) 44 3abd1c 45 select min(n) from t1; 46 min(n) 47 3dcf 48 drop table t1; 49 select min(99999999999999999.99999); 50 min(99999999999999999.99999) 51 99999999999999999.99999 52 select min(999999999999999933193939.99999); 53 min(999999999999999933193939.99999) 54 999999999999999933193939.99999 55 select min(9999999999999999999999999999999999.9999999999999); 56 min(9999999999999999999999999999999999.9999999999999) 57 9999999999999999999999999999999999.9999999999999 58 select min(-99999999999999999.99999); 59 min(-99999999999999999.99999) 60 -99999999999999999.99999 61 select min(-999999999999999933193939.99999); 62 min(-999999999999999933193939.99999) 63 -999999999999999933193939.99999 64 select min(-9999999999999999999999999999999999.9999999999999); 65 min(-9999999999999999999999999999999999.9999999999999) 66 -9999999999999999999999999999999999.9999999999999 67 create table t1(a bigint); 68 select min(a) from t1; 69 min(a) 70 null 71 insert into t1 values(null),(null),(null),(null); 72 select min(a) from t1; 73 min(a) 74 null 75 insert into t1 values(12417249128419),(124124125124151),(5124125151415),(124125152651515); 76 select min(a) from t1; 77 min(a) 78 5124125151415 79 drop table t1; 80 create table t1 ( a int not null default 1, big bigint ); 81 insert into t1 (big) values (-1),(1234567890167),(92233720368547),(18446744073709515); 82 select * from t1; 83 a big 84 1 -1 85 1 1234567890167 86 1 92233720368547 87 1 18446744073709515 88 select min(big),max(big),min(big)-1 from t1; 89 min(big) max(big) min(big)-1 90 -1 18446744073709515 -2 91 select min(big),max(big),min(big)-1 from t1 group by a; 92 min(big) max(big) min(big)-1 93 -1 18446744073709515 -2 94 insert into t1 (big) values (184467440737615); 95 select * from t1; 96 a big 97 1 -1 98 1 1234567890167 99 1 92233720368547 100 1 18446744073709515 101 1 184467440737615 102 select min(big),max(big),min(big)-1 from t1; 103 min(big) max(big) min(big)-1 104 -1 18446744073709515 -2 105 select min(big),max(big),min(big)-1 from t1 group by a; 106 min(big) max(big) min(big)-1 107 -1 18446744073709515 -2 108 drop table t1; 109 CREATE TABLE t1 (Fld1 int(11) default NULL,Fld2 int(11) default NULL); 110 INSERT INTO t1 VALUES (1,10),(1,20),(2,NULL),(2,NULL),(3,50); 111 select Fld1, min( Fld2) as q from t1 group by Fld1 having q is not null; 112 SQL syntax error: column "q" must appear in the GROUP BY clause or be used in an aggregate function 113 select Fld1, min(Fld2) from t1 group by Fld1 having min(Fld2) is not null; 114 Fld1 min(Fld2) 115 1 10 116 3 50 117 select Fld1, min(Fld2) from t1 group by Fld1 having avg(Fld2) is not null; 118 Fld1 min(Fld2) 119 1 10 120 3 50 121 select Fld1, min(Fld2) from t1 group by Fld1 having std(Fld2) is not null; 122 Fld1 min(Fld2) 123 1 10 124 3 50 125 select Fld1, min(Fld2) from t1 group by Fld1 having variance(Fld2) is not null; 126 Fld1 min(Fld2) 127 1 10 128 3 50 129 drop table t1; 130 SELECT min(1)<min(2); 131 min(1)<min(2) 132 true 133 create table t1 (grp int, a bigint unsigned, c char(10) not null); 134 insert into t1 values (1,1,"a"); 135 insert into t1 values (2,2,"b"); 136 insert into t1 values (2,3,"c"); 137 insert into t1 values (3,4,"E"); 138 insert into t1 values (3,5,"C"); 139 insert into t1 values (3,6,"D"); 140 select min(distinct a),min(distinct grp) from t1; 141 min(distinct a) min(distinct grp) 142 1 1 143 insert into t1 values (null,null,''); 144 select min(distinct a),min(distinct grp) from t1; 145 min(distinct a) min(distinct grp) 146 1 1 147 drop table t1;