EmmyMiao87 commented on a change in pull request #6230:
URL: https://github.com/apache/incubator-doris/pull/6230#discussion_r672296494



##########
File path: docs/zh-CN/administrator-guide/update.md
##########
@@ -0,0 +1,125 @@
+---
+{
+    "title": "更新",
+    "language": "zh-CN"
+}
+---
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# 更新 
+
+如果我们需要修改或更新 Doris 中的数据,就可以使用 UPDATE 命令来操作。
+
+## 适用场景
+
++ 对满足某些条件的行,修改他的取值。
++ 点更新,小范围更新,待更新的行最好是整个表的非常小一部分。
+
+## 名词解释
+
+1. Unique 模型:Doris 系统中的一种数据模型。将列分为两类,Key 和 Value。当用户导入相同 Key 的行时,后者的 Value 
会覆盖已有的 Value。与 Mysql 中的 Unique 含义一致。
+
+## 基本原理
+
+利用查询引擎自身的 where 过滤逻辑,从待更新表中筛选出需要被更新的行。再利用 Unique 模型自带的 Value 
列新数据替换旧数据的逻辑,将待更新的行变更后,再重新插入到表中。从而实现行级别更新。
+
+举例说明
+
+假设 Doris 中存在一张订单表,其中 订单id 是 Key 列,订单状态,订单金额是 Value 列。数据状态如下:
+
+|订单id | 订单金额| 订单状态|
+|---|---|---|
+| 1 | 100| 待付款 |
+
+这时候,用户点击付款后,Doris 系统需要将订单id 为 '1' 的订单状态变更为 '待发货', 就需要用到 Update 功能。
+
+```
+UPDATE order SET 订单状态='待发货' WHERE 订单id=1;
+```
+
+用户执行 UPDATE 命令后,系统会进行如下三步:
+
++ 第一步:读取满足 WHERE 订单id=1 的行
+       (1,100,'待付款')
++ 第二步:变更该行的订单状态,从'待付款'改为'待发货'
+       (1,100,'待发货')
++ 第三步:将更新后的行再插入回表中,从而达到更新的效果。
+       |订单id | 订单金额| 订单状态|
+       |---|---|---|
+       | 1 | 100| 待付款 |
+        | 1 | 100 | 待发货 |
+       由于表 order 是 UNIQUE 模型,所以相同 Key 的行,之后后者才会生效,所以最终效果如下:
+       |订单id | 订单金额| 订单状态|

Review comment:
       done

##########
File path: docs/zh-CN/administrator-guide/update.md
##########
@@ -0,0 +1,125 @@
+---
+{
+    "title": "更新",
+    "language": "zh-CN"
+}
+---
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# 更新 
+
+如果我们需要修改或更新 Doris 中的数据,就可以使用 UPDATE 命令来操作。
+
+## 适用场景
+

Review comment:
       done

##########
File path: docs/en/sql-reference/sql-statements/Data Manipulation/UPDATE.md
##########
@@ -0,0 +1,75 @@
+---

Review comment:
       done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to