Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
d2214da4
Commit
d2214da4
authored
Jun 27, 2017
by
Varun Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test case added for the percentile disc function
parent
ba9fbc6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
mysql-test/t/percentile.test
mysql-test/t/percentile.test
+41
-0
No files found.
mysql-test/t/percentile.test
0 → 100644
View file @
d2214da4
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
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment