SQL合并不匹配的目标与不匹配的源(SQL merge not matched by target vs not matched by source)

系统教程 行业动态 更新时间:2024-06-14 16:57:40
SQL合并不匹配的目标与不匹配的源(SQL merge not matched by target vs not matched by source)

需要一点帮助,我的SQL几乎不存在...

NOT MATCHED BY SOURCE与NOT MATCHED BY TARGET什么区别

例如:

WHEN NOT MATCHED BY SOURCE是否意味着记录存在于目标中而不是来源? - 所以我们可以删除它们?

和WHEN NOT MATCHED BY TARGET - 是指记录存在于源中,但不存在于目标中? 所以我们可以插入它们?

Need a little help please, my SQL is almost non existent...

What is the difference between NOT MATCHED BY SOURCE vs NOT MATCHED BY TARGET

For example:

Does WHEN NOT MATCHED BY SOURCE mean that the records exist in the target by not in the source? - so we can delete them ?

and WHEN NOT MATCHED BY TARGET - mean the records exists in the source but not in the target? so we can insert them?

最满意答案

未按目标匹配时 - 应使用此子句将新行插入到目标表中。 您插入表中的行是源表中的行中目标中没有匹配行的那些行。

未按源匹配时 - 如果要从目标表中删除与源表中的行不匹配的行

WHEN NOT MATCHED BY TARGET - You should use this clause to insert new rows into the target table. The rows you insert into the table are those rows in the source table for which there are no matching rows in the target.

WHEN NOT MATCHED BY SOURCE - If you want to delete a row from the target table that does not match a row in the source table

更多推荐

本文发布于:2023-04-13 12:36:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/58ebb3a32546af6a903766e6e9845672.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不匹配   目标   SQL   merge   source

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!