mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-20 13:15:42 +00:00
63 lines
1.1 KiB
Plaintext
63 lines
1.1 KiB
Plaintext
|
-- { echoOn }
|
||
|
|
||
|
SELECT 'Union constants';
|
||
|
Union constants
|
||
|
SELECT 1 UNION ALL SELECT 1;
|
||
|
1
|
||
|
1
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT 1 UNION DISTINCT SELECT 1 UNION ALL SELECT 1;
|
||
|
1
|
||
|
1
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT 1 INTERSECT SELECT 1;
|
||
|
1
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT 1 EXCEPT SELECT 1;
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT id FROM (SELECT 1 AS id UNION ALL SELECT 1);
|
||
|
1
|
||
|
1
|
||
|
SELECT 'Union non constants';
|
||
|
Union non constants
|
||
|
SELECT value FROM (SELECT 1 as value UNION ALL SELECT 1 UNION ALL SELECT 1);
|
||
|
1
|
||
|
1
|
||
|
1
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT id FROM test_table UNION ALL SELECT id FROM test_table;
|
||
|
0
|
||
|
0
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT id FROM test_table UNION DISTINCT SELECT id FROM test_table;
|
||
|
0
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT id FROM test_table INTERSECT SELECT id FROM test_table;
|
||
|
0
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT id FROM test_table EXCEPT SELECT id FROM test_table;
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT id FROM (SELECT id FROM test_table UNION ALL SELECT id FROM test_table);
|
||
|
0
|
||
|
0
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT id FROM (SELECT id FROM test_table UNION DISTINCT SELECT id FROM test_table);
|
||
|
0
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT id FROM (SELECT id FROM test_table INTERSECT SELECT id FROM test_table);
|
||
|
0
|
||
|
SELECT '--';
|
||
|
--
|
||
|
SELECT id FROM (SELECT id FROM test_table EXCEPT SELECT id FROM test_table);
|