2020-01-27 10:57:31 +00:00
|
|
|
DROP TABLE IF EXISTS Alpha;
|
|
|
|
DROP TABLE IF EXISTS Beta;
|
|
|
|
|
|
|
|
CREATE TABLE Alpha (foo String, bar UInt64) ENGINE = Memory;
|
|
|
|
CREATE TABLE Beta (foo LowCardinality(String), baz UInt64) ENGINE = Memory;
|
|
|
|
|
|
|
|
INSERT INTO Alpha VALUES ('a', 1);
|
|
|
|
INSERT INTO Beta VALUES ('a', 2), ('b', 3);
|
|
|
|
|
2020-02-26 13:11:06 +00:00
|
|
|
SELECT * FROM Alpha FULL JOIN (SELECT 'b' as foo) js2 USING (foo) ORDER BY foo;
|
2020-01-27 10:57:31 +00:00
|
|
|
SELECT * FROM Alpha FULL JOIN Beta USING (foo) ORDER BY foo;
|
|
|
|
SELECT * FROM Alpha FULL JOIN Beta ON Alpha.foo = Beta.foo ORDER BY foo;
|
|
|
|
|
2021-06-15 08:59:02 +00:00
|
|
|
-- https://github.com/ClickHouse/ClickHouse/issues/20315#issuecomment-789579457
|
|
|
|
SELECT materialize(js2.k) FROM (SELECT toLowCardinality(number) AS k FROM numbers(1)) AS js1 FULL OUTER JOIN (SELECT number + 7 AS k FROM numbers(1)) AS js2 USING (k) ORDER BY js2.k;
|
|
|
|
|
2020-01-27 10:57:31 +00:00
|
|
|
SET join_use_nulls = 1;
|
|
|
|
|
2020-02-26 13:11:06 +00:00
|
|
|
SELECT * FROM Alpha FULL JOIN (SELECT 'b' as foo) js2 USING (foo) ORDER BY foo;
|
2020-01-27 10:57:31 +00:00
|
|
|
SELECT * FROM Alpha FULL JOIN Beta USING (foo) ORDER BY foo;
|
|
|
|
SELECT * FROM Alpha FULL JOIN Beta ON Alpha.foo = Beta.foo ORDER BY foo;
|
2021-06-15 08:59:02 +00:00
|
|
|
SELECT materialize(js2.k) FROM (SELECT toLowCardinality(number) AS k FROM numbers(1)) AS js1 FULL OUTER JOIN (SELECT number + 7 AS k FROM numbers(1)) AS js2 USING (k) ORDER BY js2.k;
|
2020-01-27 10:57:31 +00:00
|
|
|
|
|
|
|
DROP TABLE Alpha;
|
|
|
|
DROP TABLE Beta;
|