ClickHouse/tests/queries/0_stateless/00702_join_with_using_dups.sql

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

32 lines
1.4 KiB
MySQL
Raw Normal View History

drop table if exists X;
drop table if exists Y;
create table X (id Int32, x_name String) engine Memory;
create table Y (id Int32, y_name String) engine Memory;
insert into X (id, x_name) values (1, 'A'), (2, 'B'), (2, 'C'), (3, 'D'), (4, 'E'), (4, 'F'), (5, 'G'), (8, 'H'), (9, 'I');
insert into Y (id, y_name) values (1, 'a'), (1, 'b'), (2, 'c'), (3, 'd'), (3, 'e'), (4, 'f'), (6, 'g'), (7, 'h'), (9, 'i');
select 'inner';
2022-01-31 22:25:35 +00:00
select X.*, Y.* from X inner join Y using id order by X.id, Y.id, X.x_name, Y.y_name;
select 'inner subs';
2022-01-31 22:25:35 +00:00
select s.*, j.* from (select * from X) as s inner join (select * from Y) as j using id order by s.id, s.id, s.x_name, j.y_name;
select 'left';
2022-01-31 22:25:35 +00:00
select X.*, Y.* from X left join Y using id order by X.id, Y.id, X.x_name, Y.y_name;
select 'left subs';
2022-01-31 22:25:35 +00:00
select s.*, j.* from (select * from X) as s left join (select * from Y) as j using id order by s.id, j.id, s.x_name, j.y_name;
select 'right';
2022-01-31 22:25:35 +00:00
select X.*, Y.* from X right join Y using id order by X.id, Y.id, X.x_name, Y.y_name;
select 'right subs';
2022-01-31 22:25:35 +00:00
select s.*, j.* from (select * from X) as s right join (select * from Y) as j using id order by s.id, j.id, s.x_name, j.y_name;
select 'full';
2022-02-09 11:23:20 +00:00
select X.*, Y.* from X full join Y using id order by X.id, Y.id, X.x_name, Y.y_name;
select 'full subs';
2022-01-31 22:25:35 +00:00
select s.*, j.* from (select * from X) as s full join (select * from Y) as j using id order by s.id, j.id, s.x_name, j.y_name;
drop table X;
drop table Y;