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
e64b57a8
Commit
e64b57a8
authored
Feb 05, 2016
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More testcases. Added .result file
parent
346c1a0a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
9 deletions
+68
-9
mysql-test/r/win.result
mysql-test/r/win.result
+41
-0
mysql-test/t/win.test
mysql-test/t/win.test
+27
-9
No files found.
mysql-test/r/win.result
0 → 100644
View file @
e64b57a8
drop table if exists t1,t2;
create table t1(a int, b int, x char(32));
insert into t1 values (2, 10, 'xx');
insert into t1 values (2, 10, 'zz');
insert into t1 values (2, 20, 'yy');
insert into t1 values (3, 10, 'xxx');
insert into t1 values (3, 20, 'vvv');
select a, row_number() over (partition by a order by b) from t1;
a row_number() over (partition by a order by b)
2 1
2 2
2 3
3 1
3 2
select a, b, x, row_number() over (partition by a order by x) from t1;
a b x row_number() over (partition by a order by x)
2 10 xx 1
2 10 zz 3
2 20 yy 2
3 10 xxx 2
3 20 vvv 1
drop table t1;
create table t1 (pk int primary key, a int, b int);
insert into t1 values
(1, 10, 22),
(2, 11, 21),
(3, 12, 20),
(4, 13, 19),
(5, 14, 18);
select
pk, a, b,
row_number() over (order by a),
row_number() over (order by b)
from t1;
pk a b row_number() over (order by a) row_number() over (order by b)
1 10 22 1 5
2 11 21 2 4
3 12 20 3 3
4 13 19 4 2
5 14 18 5 1
drop table t1;
mysql-test/t/win.test
View file @
e64b57a8
#
# Window Functions Tests
#
--
disable_warnings
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
create
table
t1
(
a
int
,
b
int
,
x
char
(
32
));
insert
into
t1
values
(
2
,
10
,
'xx'
);
insert
into
t1
values
(
2
,
10
,
'zz'
);
insert
into
t1
values
(
2
,
20
,
'yy'
);
insert
into
t1
values
(
3
,
10
,
'xxx'
);
insert
into
t1
values
(
3
,
20
,
'vvv'
);
# Uncommenting this line causes a crash in setup_group when executing the second
# select.
#select row_number() over (order by b) from t1;
#select a, b, x, row_number() over (partition by a,b order by x),
# row_number() over (partition by a),
# row_number() over (partition by a order by x)
#from t1;
# Uncommenting this line causes a crash in filesort during init_for_filesort.
#select a, b, x, row_number() over (partition by a order by x) from t1;
select
a
,
row_number
()
over
(
partition
by
a
order
by
b
)
from
t1
;
select
a
,
b
,
x
,
row_number
()
over
(
partition
by
a
order
by
x
)
from
t1
;
drop
table
t1
;
create
table
t1
(
pk
int
primary
key
,
a
int
,
b
int
);
insert
into
t1
values
(
1
,
10
,
22
),
(
2
,
11
,
21
),
(
3
,
12
,
20
),
(
4
,
13
,
19
),
(
5
,
14
,
18
);
select
pk
,
a
,
b
,
row_number
()
over
(
order
by
a
),
row_number
()
over
(
order
by
b
)
from
t1
;
drop
table
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