ClickHouse/tests/queries/0_stateless/00974_fix_join_on.sql

80 lines
2.7 KiB
MySQL
Raw Normal View History

drop table if exists t1;
drop table if exists t2;
2019-07-26 12:12:34 +00:00
drop table if exists t3;
create table t1 (a UInt32, b String) engine = Memory;
create table t2 (c UInt32, d String) engine = Memory;
2019-07-26 12:12:34 +00:00
create table t3 (a UInt32) engine = Memory;
insert into t1 values (1, 'x'), (2, 'y'), (3, 'z');
insert into t2 values (2, 'w'), (4, 'y');
2019-07-26 12:12:34 +00:00
insert into t3 values (3);
set enable_optimize_predicate_expression = 0;
2019-07-25 19:25:51 +00:00
select * from t1 join t2 on a = c;
select * from t1 join t2 on c = a;
select t1.a, t2.c from t1 join t2 on a = c;
select t1.a, t2.c from t1 join t2 on c = a;
select t1.b, t2.d from t1 join t2 on a = c;
select t1.b, t2.d from t1 join t2 on c = a;
select a, c from t1 join t2 on a = c;
select a, c from t1 join t2 on c = a;
select b, d from t1 join t2 on a = c;
select b, d from t1 join t2 on c = a;
select b as a, d as c from t1 join t2 on a = c;
select b as a, d as c from t1 join t2 on c = a;
select b as c, d as a from t1 join t2 on a = c;
select b as c, d as a from t1 join t2 on c = a;
2019-07-25 19:25:51 +00:00
select t1.a as a, t2.c as c from t1 join t2 on a = c;
select t1.a as a, t2.c as c from t1 join t2 on c = a;
select t1.a as c, t2.c as a from t1 join t2 on a = c;
select t1.a as c, t2.c as a from t1 join t2 on c = a;
select t1.a as c, t2.c as a from t1 join t2 on t1.a = t2.c;
select t1.a as c, t2.c as a from t1 join t2 on t2.c = t1.a;
2019-07-26 12:12:34 +00:00
select t1.a, t3.a from t1 join t3 on t1.a = t3.a;
select t1.a as t1_a, t3.a as t3_a from t1 join t3 on t1_a = t3_a;
select table1.a as t1_a, table3.a as t3_a from t1 as table1 join t3 as table3 on t1_a = t3_a;
set enable_optimize_predicate_expression = 1;
select * from t1 join t2 on a = c;
select * from t1 join t2 on c = a;
select t1.a, t2.c from t1 join t2 on a = c;
select t1.a, t2.c from t1 join t2 on c = a;
select t1.b, t2.d from t1 join t2 on a = c;
select t1.b, t2.d from t1 join t2 on c = a;
select a, c from t1 join t2 on a = c;
select a, c from t1 join t2 on c = a;
select b, d from t1 join t2 on a = c;
select b, d from t1 join t2 on c = a;
select b as a, d as c from t1 join t2 on a = c;
select b as a, d as c from t1 join t2 on c = a;
select b as c, d as a from t1 join t2 on a = c;
select b as c, d as a from t1 join t2 on c = a;
2019-07-25 19:25:51 +00:00
select t1.a as a, t2.c as c from t1 join t2 on a = c;
select t1.a as a, t2.c as c from t1 join t2 on c = a;
select t1.a as c, t2.c as a from t1 join t2 on a = c;
select t1.a as c, t2.c as a from t1 join t2 on c = a;
select t1.a as c, t2.c as a from t1 join t2 on t1.a = t2.c;
select t1.a as c, t2.c as a from t1 join t2 on t2.c = t1.a;
2019-07-26 12:12:34 +00:00
select t1.a, t3.a from t1 join t3 on t1.a = t3.a;
select t1.a as t1_a, t3.a as t3_a from t1 join t3 on t1_a = t3_a;
select table1.a as t1_a, table3.a as t3_a from t1 as table1 join t3 as table3 on t1_a = t3_a;
drop table t1;
drop table t2;
2019-07-26 12:12:34 +00:00
drop table t3;