Created
March 23, 2018 16:38
-
-
Save DevDengChao/c260d3493cd227c9f9741bb0f1182cdc to your computer and use it in GitHub Desktop.
MySQL 规避数据重复:
+ 插入数据时可以通过 `IGNORE` 来忽略当前插入的内容.
+ `REPLACE INTO` 则是将旧数据清除, 插入新数据进行替换.
+ 如果在 `REPLACE INTO` 的过程中出现了主键冲突或独特性冲突, 则可以使用 `ON DUPLICATE KEY UPDATE` 更新已有的数据.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT IGNORE authorities (create_date, created_by, enabled, last_modified_by, last_modified_date, authority) | |
VALUES (current_date(), 'Init', TRUE, 'Init', current_date(), 'USER') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment