dbms: JOINs: more tests [#METR-11370].

This commit is contained in:
Alexey Milovidov 2014-06-19 23:11:42 +04:00
parent 4645131f7a
commit a83915b62c
6 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,15 @@
A 0
A 1
B 2
B 3
C 4
C 5
D 6
D 7
E 8
E 9
F 0
G 0
H 0
I 0
J 0

View File

@ -0,0 +1,9 @@
SELECT *, joined FROM
(
SELECT reinterpretAsString(number + reinterpretAsUInt8('A')) AS k FROM system.numbers LIMIT 10
)
ALL LEFT JOIN
(
SELECT reinterpretAsString(intDiv(number, 2) + reinterpretAsUInt8('A')) AS k, number AS joined FROM system.numbers LIMIT 10
)
USING k;

View File

@ -0,0 +1,13 @@
0 0
0 6
1 1
1 7
2 0
3 0
4 0
5 0
6 0
7 0
8 2
8 8
9 0

View File

@ -0,0 +1,9 @@
SELECT left, right FROM
(
SELECT number % 4 AS k1, number % 3 AS k2, number AS left FROM system.numbers LIMIT 10
)
ALL LEFT JOIN
(
SELECT number % 2 AS k1, number % 6 AS k2, number AS right FROM system.numbers LIMIT 10
)
USING k1, k2;

View File

@ -0,0 +1,13 @@
0 0
0 6
1 1
1 7
2 0
3 0
4 0
5 0
6 0
7 0
8 2
8 8
9 0

View File

@ -0,0 +1,9 @@
SELECT left, right FROM
(
SELECT number % 4 AS k1, toString(number % 3) AS k2, number AS left FROM system.numbers LIMIT 10
)
ALL LEFT JOIN
(
SELECT number % 2 AS k1, toString(number % 6) AS k2, number AS right FROM system.numbers LIMIT 10
)
USING k1, k2;