摘要:如果你的数据量很大,想尽快完成任务执行,可否有其他方案?那一定不要错过GaussDB(DWS)的MERGE INTO功能。本文分享自华为云社区《一招教你如何高效批量导入与更新数据》,作者: acydy。
If a table T, as well as being updatable, is insertable-into, then rows can be inserted into it (subject to applicable Access Rules and Conformance Rules). The primary effect of an on T is to insert into T each of the zero or more rows contained in a specified table. The primary effect of a on T is to replace zero or more rows in T with specified rows and/or to insert into T zero or more specified rows, depending on the result of a and on whether one or both of and are specified.一张表在一条语句里面既可以被更新,也可以被插入。是否被更新还是插入取决于search condition的结果和指定的merge when matched clause(当condition匹配时做什么操作)和merge when not matched clause(当condition不匹配时做什么操作)语法。
MERGE has been extended to support multiple MATCHED and NOT MATCHED clauses, each accompanied by a search condition, that gives much greater flexibility in the coding of complex MERGE statements to handle update conflicts.MERGE INTO 命令涉及到两张表。目标表:被插入或者更新的表。源表:用于跟目标表进行匹配的表,目标表的数据来源。
欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) | Powered by Discuz! X3.4 |