Ati*_*mam 2 sql snowflake-cloud-data-platform
我有一个表,比如 table1,它有三列(col1_a、col2_b、col3_c)。我想将列重命名为col1 、 col2 、 col3。但问题是我想重命名单个查询中的所有列。
有办法实现这一点吗?
您可以使用select:
select col1_a as col1, col2_a as col2, col3_a as col3
from t;
Run Code Online (Sandbox Code Playgroud)
如果您想实际更改表中的名称,我认为您需要三个更改表:
alter table t rename column col1_a to col1;
alter table t rename column col2_a to col2;
alter table t rename column col3_a to col3;
Run Code Online (Sandbox Code Playgroud)
我认为 Snowflake 不允许使用单个alter table.
| 归档时间: |
|
| 查看次数: |
7922 次 |
| 最近记录: |