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
6533bd1b
Commit
6533bd1b
authored
Mar 17, 2016
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Window functions + ORDER BY : first testcase
parent
b0154190
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
mysql-test/r/win_orderby.result
mysql-test/r/win_orderby.result
+26
-0
mysql-test/t/win_orderby.test
mysql-test/t/win_orderby.test
+32
-0
No files found.
mysql-test/r/win_orderby.result
0 → 100644
View file @
6533bd1b
drop table if exists t0,t1;
create table t0(a int primary key);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(
pk int,
a int,
key(pk)
);
insert into t1
select
A.a + B.a* 10 + C.a * 100,
1
from t0 A, t0 B, t0 C;
select
pk,
count(a) over (order by pk rows between 2 preceding and 2 following)
from t1
where pk between 1 and 30
order by pk desc
limit 4;
pk count(a) over (order by pk rows between 2 preceding and 2 following)
30 3
29 4
28 5
27 5
drop table t0,t1;
mysql-test/t/win_orderby.test
0 → 100644
View file @
6533bd1b
#
# Tests for window functions and ORDER BY
#
--
disable_warnings
drop
table
if
exists
t0
,
t1
;
--
enable_warnings
create
table
t0
(
a
int
primary
key
);
insert
into
t0
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
create
table
t1
(
pk
int
,
a
int
,
key
(
pk
)
);
insert
into
t1
select
A
.
a
+
B
.
a
*
10
+
C
.
a
*
100
,
1
from
t0
A
,
t0
B
,
t0
C
;
select
pk
,
count
(
a
)
over
(
order
by
pk
rows
between
2
preceding
and
2
following
)
from
t1
where
pk
between
1
and
30
order
by
pk
desc
limit
4
;
drop
table
t0
,
t1
;
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