跳到主要内容

ALTER VIEW

通过使用另一个 QUERY 来更改现有视图。

Syntax

ALTER VIEW [ <database_name>. ]view_name [ (<column>, ...) ] AS SELECT query

Examples

CREATE VIEW tmp_view AS SELECT number % 3 AS a, avg(number) FROM numbers(1000) GROUP BY a ORDER BY a;

SELECT * FROM tmp_view;
+------+-------------+
| a | avg(number) |
+------+-------------+
| 0 | 499.5 |
| 1 | 499.0 |
| 2 | 500.0 |
+------+-------------+

ALTER VIEW tmp_view(c1) AS SELECT * from numbers(3);

SELECT * FROM tmp_view;
+------+
| c1 |
+------+
| 0 |
| 1 |
| 2 |
+------+
欢迎体验 Databend Cloud

基于 Rust + 对象存储构建的新一代多模态数仓,一个平台即可进行 BI、向量、全文检索及地理空间分析。

支持标准 SQL,自动弹性伸缩,助您快速构建现代化数据平台。

注册即领 ¥200 代金券。

注册体验