This article combines a large number of articles related to SQL replace into and focuses their usage and advantages in this article. If you need some commands, you can take a closer look.
The following is a more detailed description of the algorithm
The following is a more detailed description of the algorithm used (the algorithm is also used for load DATA ...). REPLACE):
1. Try inserting the new row into the table
2. When an insert fails because of a duplicate keyword error for a primary key
When inserting data into a table, we often encounter situations such as: 1, first to determine whether the data exists, 2, if it does not exist, then insert; 3, if present, update. This can be handled in SQL Server:If not exists (select 1 from t
SQL replace into usage detailed description
The run of replace is similar to insert. With one exception, if an old record in the table is used with a primary
Key or a new record of a unique index has the same value, the old record is deleted
SQL replace into usage
Replace runs like insert. There is only one exception. Assume that an old record in the table and a record used for primary
If the new record of a key or unique index has the same value, the old record is deleted before the
SQL replace into usage detailed descriptionThe replace operation is similar to insert. There is only one exception, if an old record in the table is used with a primaryA new record of key or a unique index has the same value, and the old record is
The run of replace is very similar to insert. Except for one point, if an old record in the table has the same value as a new record for primary key or a unique index, the old record is deleted before the new record is inserted.
Note that it is
This article is a detailed analysis of the difference between replace into and insert into SQL statements, the need for a friend under the reference
The run of replace is similar to insert. With one exception, if an old record in the table has the
Original link: http://www.jb51.net/article/47090.htm Today listen to colleagues about Oracle to MySQL data migration, he used insert into ... on duplicate key Update ..., I was thinking how not to replace it, so I came back to look carefully, they
Replace into and Insert... on duplicate key update... what's really different today I heard from my colleagues about the data migration from oracle to mysql. He used Insert ..... on duplicate key update ..., I was wondering why I didn't need Replace
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.