1. 程式人生 > >mysql insert語法注意事項(ON DUPLICATE KEY UPDATE )

mysql insert語法注意事項(ON DUPLICATE KEY UPDATE )

NSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]

       [INTO] tbl_name [(col_name,...)]

       VALUES ({expr | DEFAULT},...),(...),...

       [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]

或:

INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]

       [INTO] tbl_name

       SET col_name={expr | DEFAULT}, ...

       [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]

或:

INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]

       [INTO] tbl_name [(col_name,...)]

       SELECT ...

       [ ON DUPLICATE KEY UPDATE col_name=expr, ... ]