测试结果:
1. 只能使用一个select, 下一个select会提示结束符, 也就是不能有子查询2. 且不能出现括号 ( , 有括号会提示语法错误
测试结果表明: 一个view只能通过一个table表创建
现在是2018年4月24日, 测试环境Phoenix 4.8, 这个问题官网说正在解决
Phoenix官网view介绍
Limitations
Views have the following restrictions:
- An INDEX over a VIEW is only maintained if the updates are made through the VIEW. Updates made through the underlying TABLE or the parent VIEW will not be reflected in the index (PHOENIX-1499).
- A primary key column may not be added to a VIEW when its base table has a primary key constraint that ends with a variable length column (PHOENIX-2157).
- A VIEW may be defined over only a single table through a simple SELECT * query. You may not create a VIEW over multiple, joined tables nor over aggregations (PHOENIX-1505, PHOENIX-1506).
- When a column is added to a VIEW, the new column will not be automatically added to any child VIEWs (PHOENIX-2054). The workaround is to manually add the column to the child VIEWs.
- All columns must be projected into a VIEW when it’s created (i.e. only CREATE VIEW … AS SELECT * is supported). Note, however, you may drop non primary key columns inherited from the base table in a VIEW after it is created through the ALTER VIEW command. Providing a subset of columns and or expressions in the SELECT clause will be supported in a future release (PHOENIX-1507).
谷歌翻译
限制
视图有以下限制:
- 只有通过VIEW进行更新时,才能维护VIEW上的INDEX。通过底层TABLE或父VIEW进行的更新不会反映在索引(PHOENIX-1499)中。
- 如果主键列的主键约束以可变长度列(PHOENIX-2157)结尾,则主键列不能添加到VIEW中。
- VIEW可以通过简单的SELECT *查询仅在单个表上定义。您不能在多个连接的表格或聚合(PHOENIX-1505,PHOENIX-1506)上创建VIEW 。
- 当一个列添加到VIEW时,新列不会自动添加到任何子视图(PHOENIX-2054)。解决方法是手动将该列添加到子视图。
- 所有列在创建时都必须投影到VIEW中(即仅支持CREATE VIEW ... AS SELECT *)。但是,请注意,在通过ALTER VIEW命令创建后,您可以在VIEW中删除从基表继承的非主键列。在未来的版本(PHOENIX-1507)中支持在SELECT子句中提供列和或表达式的子集。