SHOW VIEWS
语法
SHOW VIEWS [IN/FROM database_name] [ LIKE pattern [ESCAPE escapeChar] ]
描述
列举指定Schema中所有满足条件的视图。
默认使用当前Schema,也可以通过in/from子句来指定Schema。
通过可选子句“LIKE”,筛选视图名满足规则运算表达式的视图,如果不使用这个子句,会列举所有视图。匹配的视图会按字母顺序排列。
目前规则运算表达式只支持“*”(匹配任意字符)。
示例
创建示例所需视图:
Create schema test1; Use test1; Create table t1(id int, name string); Create view v1 as select * from t1; Create view v2 as select * from t1; Create view t1view as select * from t1; Create view t2view as select * from t1; Show views; Table -------- t1view t2view v1 v2 (4 rows) Show views like 'v1'; Table ------- v1 (1 row) Show views 'v_'; Table ------- v1 v2 (2 rows) show views like 't*'; Table -------- t1view t2view Show views in test1; Table -------- t1view t2view v1 v2 (4 rows)