summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/win_percent_cume.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/win_percent_cume.test
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/win_percent_cume.test')
-rw-r--r--mysql-test/main/win_percent_cume.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/main/win_percent_cume.test b/mysql-test/main/win_percent_cume.test
new file mode 100644
index 00000000..05ace95d
--- /dev/null
+++ b/mysql-test/main/win_percent_cume.test
@@ -0,0 +1,36 @@
+create table t1 (
+ pk int primary key,
+ a int,
+ b int
+);
+
+
+insert into t1 values
+( 1 , 0, 10),
+( 2 , 0, 10),
+( 3 , 1, 10),
+( 4 , 1, 10),
+( 8 , 2, 10),
+( 5 , 2, 20),
+( 6 , 2, 20),
+( 7 , 2, 20),
+( 9 , 4, 20),
+(10 , 4, 20);
+
+select a,
+ percent_rank() over (order by a),
+ cume_dist() over (order by a)
+from t1;
+
+select pk,
+ percent_rank() over (order by pk),
+ cume_dist() over (order by pk)
+from t1 order by pk;
+
+select a,
+ percent_rank() over (partition by a order by a),
+ cume_dist() over (partition by a order by a)
+from t1;
+
+drop table t1;
+