Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 MySQL 中插入
哪个 SQL 更好?你能给我一个建议吗?
取决于你对他们做什么。 REPLACE INTO技术上更快,因为它不必在更新之前进行读取(但这几乎无关紧要),但我觉得INSERT INTO ... ON DUPLICATE KEY UPDATE通常更清楚你想要做什么。
REPLACE INTO
INSERT INTO ... ON DUPLICATE KEY UPDATE
这是博客中的简短讨论。