课程: Hands-On Introduction: SQL

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Merge rows in a table

Merge rows in a table

- [Instructor] In this video, we will be learning about the last DML statement. That is merge. It updates or inserts data in tables based on a condition. If the row is already there in the table, it updates it, otherwise it inserts a new row in the table. Instead of giving loops, we just use one merge statement. Hence, it improves performance. It's useful in data warehouse systems. As the data comes from various sources and there is a possibility for duplicate records to be inserted into the table. To prevent that, we use the merge statement. This is the syntax. This table name is the table where all the rows must be inserted or updated. This is the source from where we get the data to be inserted or updated. ON clause has the condition which determines whether to insert or update. When matched or when not matched clause instructs the server what to do when the condition is matched or not matched. So this is…

内容