MySQL/INSERT INTO:修订间差异
来自康健生活
| 第54行: | 第54行: | ||
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"> | 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) | Query OK, 2 rows affected (0.01 sec) | ||
</syntaxhighlight>|mysql>}} | |||
{{Shc_out|<syntaxhighlight lang="mysql"> | |||
SELECT * FROM user;</syntaxhighlight>|<syntaxhighlight lang="bash"> | |||
+----+----------+---------------------+ | |||
| id | name | email | | |||
+----+----------+---------------------+ | |||
| 1 | kangjian | kangjian@kangkk.com | | |||
| 2 | kangkk | kangkk@kangkk.com | | |||
| 3 | kk | kk@kangkk.com | | |||
| 4 | test | test@kangkk.com | | |||
| 5 | lanqian | NULL | | |||
| 6 | lanlan | | | |||
+----+----------+---------------------+ | |||
6 rows in set (0.00 sec) | |||
</syntaxhighlight>|mysql>}} | </syntaxhighlight>|mysql>}} | ||