diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/win_percent_cume.test | |
parent | Initial commit. (diff) | |
download | mariadb-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.test | 36 |
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; + |