ClickHouse/tests/queries/0_stateless/02373_analyzer_join_use_nulls.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
2.9 KiB
MySQL
Raw Normal View History

2022-08-20 14:32:00 +00:00
SET use_analyzer = 1;
SET join_use_nulls = 1;
DROP TABLE IF EXISTS test_table_join_1;
CREATE TABLE test_table_join_1
(
id UInt64,
value String
) ENGINE = TinyLog;
DROP TABLE IF EXISTS test_table_join_2;
CREATE TABLE test_table_join_2
(
id UInt64,
value String
) ENGINE = TinyLog;
INSERT INTO test_table_join_1 VALUES (0, 'Join_1_Value_0');
INSERT INTO test_table_join_1 VALUES (1, 'Join_1_Value_1');
2022-08-20 20:15:33 +00:00
INSERT INTO test_table_join_1 VALUES (2, 'Join_1_Value_2');
2022-08-20 14:32:00 +00:00
INSERT INTO test_table_join_2 VALUES (0, 'Join_2_Value_0');
INSERT INTO test_table_join_2 VALUES (1, 'Join_2_Value_1');
2022-08-20 20:15:33 +00:00
INSERT INTO test_table_join_2 VALUES (3, 'Join_2_Value_3');
2022-08-20 14:32:00 +00:00
-- { echoOn }
SELECT t1.id AS t1_id, toTypeName(t1_id), t1.value AS t1_value, toTypeName(t1_value), t2.id AS t2_id, toTypeName(t2_id), t2.value AS t2_value, toTypeName(t2_value)
FROM test_table_join_1 AS t1 INNER JOIN test_table_join_2 AS t2 ON t1.id = t2.id;
SELECT '--';
SELECT t1.id AS t1_id, toTypeName(t1_id), t1.value AS t1_value, toTypeName(t1_value), t2.id AS t2_id, toTypeName(t2_id), t2.value AS t2_value, toTypeName(t2_value)
FROM test_table_join_1 AS t1 LEFT JOIN test_table_join_2 AS t2 ON t1.id = t2.id;
SELECT '--';
SELECT t1.id AS t1_id, toTypeName(t1_id), t1.value AS t1_value, toTypeName(t1_value), t2.id AS t2_id, toTypeName(t2_id), t2.value AS t2_value, toTypeName(t2_value)
FROM test_table_join_1 AS t1 RIGHT JOIN test_table_join_2 AS t2 ON t1.id = t2.id;
SELECT '--';
SELECT t1.id AS t1_id, toTypeName(t1_id), t1.value AS t1_value, toTypeName(t1_value), t2.id AS t2_id, toTypeName(t2_id), t2.value AS t2_value, toTypeName(t2_value)
FROM test_table_join_1 AS t1 FULL JOIN test_table_join_2 AS t2 ON t1.id = t2.id;
SELECT '--';
2022-08-20 20:15:33 +00:00
SELECT id AS using_id, toTypeName(using_id), t1.id AS t1_id, toTypeName(t1_id), t1.value AS t1_value, toTypeName(t1_value),
t2.id AS t2_id, toTypeName(t2_id), t2.value AS t2_value, toTypeName(t2_value)
2022-08-20 14:32:00 +00:00
FROM test_table_join_1 AS t1 INNER JOIN test_table_join_2 AS t2 USING (id);
SELECT '--';
2022-08-20 20:15:33 +00:00
SELECT id AS using_id, toTypeName(using_id), t1.id AS t1_id, toTypeName(t1_id), t1.value AS t1_value, toTypeName(t1_value),
t2.id AS t2_id, toTypeName(t2_id), t2.value AS t2_value, toTypeName(t2_value)
2022-08-20 14:32:00 +00:00
FROM test_table_join_1 AS t1 LEFT JOIN test_table_join_2 AS t2 USING (id);
SELECT '--';
2022-08-20 20:15:33 +00:00
SELECT id AS using_id, toTypeName(using_id), t1.id AS t1_id, toTypeName(t1_id), t1.value AS t1_value, toTypeName(t1_value),
t2.id AS t2_id, toTypeName(t2_id), t2.value AS t2_value, toTypeName(t2_value)
2022-08-20 14:32:00 +00:00
FROM test_table_join_1 AS t1 RIGHT JOIN test_table_join_2 AS t2 USING (id);
SELECT '--';
2022-08-20 20:15:33 +00:00
SELECT id AS using_id, toTypeName(using_id), t1.id AS t1_id, toTypeName(t1_id), t1.value AS t1_value, toTypeName(t1_value),
t2.id AS t2_id, toTypeName(t2_id), t2.value AS t2_value, toTypeName(t2_value)
2022-08-20 14:32:00 +00:00
FROM test_table_join_1 AS t1 FULL JOIN test_table_join_2 AS t2 USING (id);
-- { echoOff }
DROP TABLE test_table_join_1;
DROP TABLE test_table_join_2;