mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 04:52:10 +00:00
46 lines
1.0 KiB
Plaintext
46 lines
1.0 KiB
Plaintext
-- { echoOn }
|
|
|
|
SELECT * FROM test1 LEFT JOIN test2 ON test1.col1 = test2.col1
|
|
WHERE test2.col1 IS NULL
|
|
ORDER BY test2.col1
|
|
;
|
|
12321 -30 \N \N
|
|
SELECT * FROM test2 RIGHT JOIN test1 ON test2.col1 = test1.col1
|
|
WHERE test2.col1 IS NULL
|
|
ORDER BY test2.col1
|
|
;
|
|
\N \N 12321 -30
|
|
SELECT * FROM test1 LEFT JOIN test2 ON test1.col1 = test2.col1
|
|
WHERE test2.col1 IS NOT NULL
|
|
ORDER BY test2.col1
|
|
;
|
|
123 123 123 5600
|
|
321 -32 321 5601
|
|
SELECT * FROM test2 RIGHT JOIN test1 ON test2.col1 = test1.col1
|
|
WHERE test2.col1 IS NOT NULL
|
|
ORDER BY test2.col1
|
|
;
|
|
123 5600 123 123
|
|
321 5601 321 -32
|
|
SELECT test2.col1, test1.* FROM test2 RIGHT JOIN test1 ON test2.col1 = test1.col1
|
|
WHERE test2.col1 IS NOT NULL
|
|
ORDER BY test2.col1
|
|
;
|
|
123 123 123
|
|
321 321 -32
|
|
SELECT test2.col3, test1.* FROM test2 RIGHT JOIN test1 ON test2.col1 = test1.col1
|
|
WHERE test2.col1 IS NOT NULL
|
|
ORDER BY test2.col1
|
|
;
|
|
5600 123 123
|
|
5601 321 -32
|
|
SELECT col2, col2 + 1 FROM test1
|
|
FULL OUTER JOIN test2 USING (col1)
|
|
PREWHERE (col2 * 2) :: UInt8
|
|
;
|
|
123 124
|
|
-32 -31
|
|
-30 -29
|
|
DROP TABLE IF EXISTS test1;
|
|
DROP TABLE IF EXISTS test2;
|