Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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;
Comment

mySql on duplicate key update

INSERT INTO table (column_list)
VALUES (value_list)
ON DUPLICATE KEY UPDATE
   c1 = v1, 
   c2 = v2,
   ...;
Comment

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`);
Comment

mysql on duplicate key ignore

INSERT INTO table_tags (tag) VALUES ('tag_a'),('tab_b'),('tag_c') ON DUPLICATE KEY UPDATE tag=tag;
Comment

mysql on duplicate key update

UPDATE t1 SET c=c+1 WHERE a=1 OR b=2 LIMIT 1;
Comment

PREVIOUS NEXT
Code Example
Sql :: select sequence oracle 
Sql :: rename column sql 
Sql :: plsql print 
Sql :: ms sql create user 
Sql :: how to drop a table in mysql 
Sql :: 3 days back in sql server 
Sql :: mysql update add to existing value 
Sql :: check if database exists sql 
Sql :: sql stored procedure with output parameters 
Sql :: mysql query single row 
Sql :: mysql remove html tag 
Sql :: how to get the date from datetime in mysql 
Sql :: current date in postgresql minus 1 day 
Sql :: mysql to get column name in database 
Sql :: replace null value within column mysql 
Sql :: sql select most frequent value in column 
Sql :: postgres : ERROR: division by zero 
Sql :: add primary key with auto increment to existing table column mysql 
Sql :: create table split string function in sql server 
Sql :: check if value is equal to something sql 
Sql :: how to drop a unique constraint in sql 
Sql :: postgres select duplicate columns 
Sql :: mysql trim spaces 
Sql :: postgresql delete limit 
Sql :: install postgresql 10 centos 7 
Sql :: xampp mysql version 
Sql :: how to check table name in current database sql 
Sql :: mysql run sql file 
Sql :: find usage of table in sql server 
Sql :: commit in sql 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =