REPLACE versus INSERT in SQL
问题 I am doing the following SQL tutorial: http://sql.learncodethehardway.org/book/ex11.html and in this exercise the author says in the second paragraph: In this situation, I want to replace my record with another guy but keep the unique id. Problem is I'd have to either do a DELETE/INSERT in a transaction to make it atomic, or I'd need to do a full UPDATE. Could anyone explain to me what the problem is with doing an UPDATE, and when we might choose REPLACE instead of UPDATE? The UPDATE code: