ClickHouse/tests/queries/0_stateless/01031_semi_anti_join.sql

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

26 lines
838 B
MySQL
Raw Normal View History

2019-12-02 18:07:27 +00:00
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (x UInt32, s String) engine = Memory;
CREATE TABLE t2 (x UInt32, s String) engine = Memory;
2019-12-04 20:23:07 +00:00
INSERT INTO t1 (x, s) VALUES (0, 'a1'), (1, 'a2'), (2, 'a3'), (3, 'a4'), (4, 'a5'), (2, 'a6');
2019-12-02 18:07:27 +00:00
INSERT INTO t2 (x, s) VALUES (2, 'b1'), (2, 'b2'), (4, 'b3'), (4, 'b4'), (4, 'b5'), (5, 'b6');
SET join_use_nulls = 0;
SELECT 'semi left';
2022-02-09 11:23:20 +00:00
SELECT t1.*, t2.* FROM t1 SEMI LEFT JOIN t2 USING(x) ORDER BY t1.x, t2.x, t1.s, t2.s;
2019-12-02 18:07:27 +00:00
SELECT 'semi right';
2022-02-09 11:23:20 +00:00
SELECT t1.*, t2.* FROM t1 SEMI RIGHT JOIN t2 USING(x) ORDER BY t1.x, t2.x, t1.s, t2.s;
2019-12-02 18:07:27 +00:00
SELECT 'anti left';
2022-02-09 11:23:20 +00:00
SELECT t1.*, t2.* FROM t1 ANTI LEFT JOIN t2 USING(x) ORDER BY t1.x, t2.x, t1.s, t2.s;
2019-12-02 18:07:27 +00:00
SELECT 'anti right';
2022-02-09 11:23:20 +00:00
SELECT t1.*, t2.* FROM t1 ANTI RIGHT JOIN t2 USING(x) ORDER BY t1.x, t2.x, t1.s, t2.s;
2019-12-02 18:07:27 +00:00
DROP TABLE t1;
DROP TABLE t2;