Answers for "mysql update unique"

SQL
3

mysql set field unique

ALTER TABLE mytbl ADD UNIQUE (columnName);
Posted by: Guest on March-06-2020
2

mysql on duplicate key update

INSERT INTO t1 (a,b,c) VALUES (1,2,3)
  ON DUPLICATE KEY UPDATE c=3;
INSERT INTO t1 (a,b,c) VALUES (4,5,6)
  ON DUPLICATE KEY UPDATE c=9;
Posted by: Guest on October-28-2020
0

mysql on duplicate key update get value from values

INSERT INTO `tableName` (`a`,`b`,`c`) VALUES (1,2,3)
ON DUPLICATE KEY UPDATE `a`=VALUES(`a`), `b`=VALUES(`b`), `c`=VALUES(`c`);
Posted by: Guest on December-28-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language