MySQL/INSERT INTO:修订间差异
来自康健生活
| 第50行: | 第50行: | ||
== on duplicate key update == | == on duplicate key update == | ||
如果数据(主键或唯一索引)存在,则执行更新操作。 | |||
{{Shc_out|<syntaxhighlight lang="mysql"> | |||
INSERT INTO user(id, name, email) values(3, 'kk', 'kk@kangkk.com') on duplicate key update name='kk', email='kk@kangkk.com';</syntaxhighlight>|<syntaxhighlight lang="bash"> | |||
Query OK, 2 rows affected (0.01 sec) | |||
</syntaxhighlight>|mysql>}} | |||
== other == | == other == | ||