-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test case added for the percentile disc function
- Loading branch information
1 parent
ba9fbc6
commit d2214da
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
CREATE TABLE student (name CHAR(10), test double, score TINYINT); | ||
|
||
INSERT INTO student VALUES | ||
('Chun', 0, null), ('Chun', 0, 4), | ||
('Esben', 1, null), ('Esben', 1, null), | ||
('Kaolin', 0.5, 56), ('Kaolin', 0.5, 88), | ||
('Tatiana', 0.8, 2), ('Tatiana', 0.8, 1); | ||
|
||
|
||
|
||
select name, percentile_disc(0.6) within group(order by score) over (partition by name) from student; | ||
select name, percentile_disc(test) within group(order by score) over (partition by name) from student; | ||
select name, percentile_disc(0.4) within group(order by score) over (partition by name) from student; | ||
|
||
|
||
#select name, percentile_cont(null) within group(order by score) over (partition by name) from student; | ||
#select name, cume_dist() over (partition by name order by score) from student; | ||
|
||
|
||
#normal parsing | ||
#select percentile_cont(0.5) within group(order by score) over w1 from student | ||
#window w1 AS (partition by name); | ||
|
||
# no partition clause | ||
#select percentile_cont(0.5) within group(order by score) over () from student; | ||
|
||
|
||
# only one sort allowed | ||
#select percentile_cont(0.5) within group(order by score) over (partition by name); | ||
|
||
#parameter value should be in the range of 0 to 1 | ||
#select percentile_cont(1.5) within group(order by score) over (partition by name); | ||
|
||
|
||
# | ||
#select rank() over (partition by name order by score ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) from student; | ||
|
||
|
||
|
||
drop table student; | ||
|