更新时间:2024-04-09 GMT+08:00
分享

UPDATE

语法

UPDATE tablename SET column = value [, column = value ...] [WHERE expression]

描述

根据条件更新表数据。

限制

  • 仅支持orc格式的事务表,并且不能为external Table。
  • 不支持set(column_name1,column_name2,…)=(value1,value2,…)的语法。

示例

-- 创建事务表
create table upd_tb(col1 int,col2 string)  with (format='orc',transactional=true);

--插入数据
insert into upd_tb values (3,'A'),(4,'B');

--修改col1 = 4的数据
update upd_tb set col1=5 where col1=4;

--查询表,col1=4的记录已被修改
select * from upd_tb; -- 
 col1 | col2 
------|------
    5 | B    
    3 | A  
分享:

    相关文档

    相关产品