Skip to content

Instantly share code, notes, and snippets.

View DevDengChao's full-sized avatar
😃
Happy coding

邓超 DevDengChao

😃
Happy coding
View GitHub Profile
@DevDengChao
DevDengChao / data-mysql.sql
Created March 23, 2018 16:38
MySQL 规避数据重复: + 插入数据时可以通过 `IGNORE` 来忽略当前插入的内容. + `REPLACE INTO` 则是将旧数据清除, 插入新数据进行替换. + 如果在 `REPLACE INTO` 的过程中出现了主键冲突或独特性冲突, 则可以使用 `ON DUPLICATE KEY UPDATE` 更新已有的数据.
INSERT IGNORE authorities (create_date, created_by, enabled, last_modified_by, last_modified_date, authority)
VALUES (current_date(), 'Init', TRUE, 'Init', current_date(), 'USER')