luooofan / miniob-2023

2023 OceanBase 数据库大赛初赛
https://open.oceanbase.com/train?questionId=600004
Mulan Permissive Software License, Version 2
78 stars 34 forks source link

[2023 Topic]: Create_table_select #32

Closed Zhang-X0 closed 1 year ago

Zhang-X0 commented 1 year ago

topic: create_table_select

description:

Zhang-X0 commented 1 year ago

Failed Case

create table create_table_select_t1(id int, age int, name char); create table create_table_select_t2(id int, age int, name char); create table create_table_select_t5 as select id, age, id+age as sum from create_table_select_t1; create table create_table_select_t6 as select t1.id, t1.age, t2.name from create_table_select_t1 t1, create_table_select_t2 t2 where t1.id=t2.id; select count(*) from create_table_select_t6; select count(id) from create_table_select_t6; -118 +FAILURE

自己构造的测试用例

create table t1(c1 int, c2 int not null); insert into t1 values(1,1),(2,2); create table t2(c1 int, c2 int, c3 int); insert into t2 values(1,1,1),(2,2,2);

-- 未指定、别名field create table t3 select t.c1, t.c2 from t1 t;

-- 未指定、 create table t4 as select c1, c2, c1+1 from t1; create table t4 as select c1, c2, c2+1 as sum from t1;

-- 指定、field create table t5(x1 int, x2 int) as select c1, c2 from t1;

-- 指定、expr create table t6(x1 int, x2 int, x3 int) as select c1, c1+c2, c2+1 from t1; create table t7 as select a1.c1, a1.c2, a2.c3 from t1 a1, t2 a2 where a1.c1=a2.c1;