mark some file to been opensource for ce-farm

This commit is contained in:
niyuhang
2023-11-15 11:44:43 +00:00
committed by ob-robot
parent 4900683cff
commit c8ace58297
685 changed files with 1080566 additions and 111051 deletions

View File

@ -0,0 +1,67 @@
drop table if exists t1,t2;
CREATE TABLE t1 (pk int primary key, a VARCHAR(400));
INSERT INTO t1 VALUES (1,'A'), (2,'a'), (3,'a '), (4,'a '),
(5,'B'), (6,'b'), (7,'b '), (8,'b ');
SELECT COUNT(DISTINCT a) FROM t1;
COUNT(DISTINCT a)
2
DROP TABLE t1;
CREATE TABLE t1 (pk int primary key, a int, b int, c int);
INSERT INTO t1 (pk, a, b, c) VALUES
(1,1,1,1), (2,1,1,2), (3,1,1,3),
(4,1,2,1), (5,1,2,2), (6,1,2,3),
(7,1,3,1), (8,1,3,2), (9,1,3,3),
(10,2,1,1), (11,2,1,2), (12,2,1,3),
(13,2,2,1), (14,2,2,2), (15,2,2,3),
(16,2,3,1), (17,2,3,2), (18,2,3,3),
(19,3,1,1), (20,3,1,2), (21,3,1,3),
(22,3,2,1), (23,3,2,2), (24,3,2,3),
(25,3,3,1), (26,3,3,2), (27,3,3,3);
SELECT b/c as v, a FROM t1 ORDER BY v, a;
v a
0.3333 1
0.3333 2
0.3333 3
0.5000 1
0.5000 2
0.5000 3
0.6667 1
0.6667 2
0.6667 3
1.0000 1
1.0000 1
1.0000 1
1.0000 2
1.0000 2
1.0000 2
1.0000 3
1.0000 3
1.0000 3
1.5000 1
1.5000 2
1.5000 3
2.0000 1
2.0000 2
2.0000 3
3.0000 1
3.0000 2
3.0000 3
SELECT b/c as v, SUM(a) FROM t1 GROUP BY v ORDER BY v;
v SUM(a)
0.3333 6
0.5000 6
0.6667 6
1.0000 18
1.5000 6
2.0000 6
3.0000 6
SELECT SUM(a) as suma FROM t1 GROUP BY b/c ORDER BY suma;
suma
6
6
6
6
6
6
18
DROP TABLE t1;