mariadb/mysql-test/main/win_percent_cume.test
Marko Mäkelä df563e0c03 Merge 10.2 into 10.3
main.derived_cond_pushdown: Move all 10.3 tests to the end,
trim trailing white space, and add an "End of 10.3 tests" marker.
Add --sorted_result to tests where the ordering is not deterministic.

main.win_percentile: Add --sorted_result to tests where the
ordering is no longer deterministic.
2018-11-06 09:40:39 +02:00

36 lines
576 B
Text

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;