github.com/matrixorigin/matrixone@v0.7.0/test/distributed/cases/view/view.result (about) 1 drop table if exists t1; 2 drop table if exists t2; 3 create table t1 (a int, b int); 4 create table t2 (aa int, bb varchar(20)); 5 create view v1 as select * from t1; 6 select * from v1; 7 a b 8 insert into t1 values (1, 11), (2, 22), (3, 33); 9 insert into t2 values (1, "aa"), (2, "bb"); 10 show columns from v1; 11 Field Type Null Key Default Comment 12 a INT YES NULL 13 b INT YES NULL 14 select * from v1 where a > 1; 15 a b 16 2 22 17 3 33 18 select * from v1, t2 where v1.a = t2.aa; 19 a b aa bb 20 1 11 1 aa 21 2 22 2 bb 22 create database db2; 23 use db2; 24 select * from view.v1 where a > 1; 25 a b 26 2 22 27 3 33 28 use view; 29 drop database db2; 30 drop table t1; 31 select * from v1; 32 SQL parser error: table "t1" does not exist 33 drop table v1; 34 no such table view.v1 35 drop view v1; 36 show create view vvvv; 37 invalid input: show view 'vvvv' is not a valid view 38 create view v1 as select "a"; 39 show create view v1; 40 View Create View 41 v1 create view v1 as select "a"; 42 create view v2 as select 'a'; 43 show create view v2; 44 View Create View 45 v2 create view v2 as select 'a'; 46 show create table v2; 47 View Create View 48 v2 create view v2 as select 'a'; 49 drop view v1; 50 drop view v2; 51 create table tt(a int); 52 create view vv as select * from tt; 53 drop table if exists tt; 54 drop table if exists vv; 55 drop view vv; 56 57 drop table if exists t1; 58 create table t1 (a int); 59 insert into t1 values(1); 60 drop table if exists t2; 61 create table t2 (a int); 62 insert into t2 values(1); 63 create view vvvv as select a from t1 union all select a from t2; 64 select * from vvvv; 65 a 66 1 67 1 68 drop view vvvv; 69 70 drop table if exists t1; 71 create table t1 (a int); 72 insert into t1 values(1),(2),(3),(4); 73 create view v5 as select * from t1; 74 select * from v5; 75 a 76 1 77 2 78 3 79 4 80 alter view v5 as select * from t1 where a=1; 81 select * from v5; 82 a 83 1 84 alter view v5 as select * from t1 where a > 2; 85 select * from v5; 86 a 87 3 88 4 89 alter view if exists v6 as select * from t1; 90 drop view v5; 91 drop table if exists t1; 92 create table t1( a int primary key, b varchar(15) ); 93 insert into t1 values(1, 'aaaa'),(2, 'bbbbbb'),(3, 'cccccccc'); 94 create view v1 as select (case when a>1 then 'NO' else 'YES' end) as IS_NULLABLE from t1; 95 desc v1; 96 Field Type Null Key Default Extra Comment 97 is_nullable VARCHAR(3) YES NULL 98 drop view v1; 99 drop database if exists test; 100 create database test; 101 use test; 102 drop table if exists t1; 103 create table t1(a int); 104 create view v1 as select * from t1; 105 SELECT relname, rel_createsql,relkind FROM mo_catalog.mo_tables WHERE reldatabase='test' order by relname; 106 relname rel_createsql relkind 107 %!%mo_increment_columns 108 t1 create table t1(a int); r 109 v1 create view v1 as select * from t1; v 110 drop database test;