Replace usage in mysql there are three forms of MySQL replace into: 1. replace into tbl_name (col_name ,...) values (...) 2. replace into tbl_name (col_name ,...) select... 3. replace into tbl_name set col_name = value ,... the first form is similar to insert into. The second replace select method is similar to insert select, which does not necessarily require column name matching. In fact, MYSQL does not even care about the column name returned by select, it requires the column position. For example, replace into tb1 (name, title, mood) select rname, rtitle, rmood from tb2 ;? In this example, replace into is used from? Import all data to tb1 in tb2. The third replace set usage of www.2cto.com is similar to the update set usage, and a value assignment such as "SET col_name = col_name + 1" is used, the reference to the column name on the right is processed as DEFAULT (col_name. Therefore, the value is equivalent to SET col_name = DEFAULT (col_name) + 1. Full usage statement: replace into 'table' ('unique _ column', 'num') VALUES ('$ unique_value', $ num ); insert into 'table' ('unique _ column', 'num') VALUES ('$ unique_value', $ num) on duplicate update num = $ num; in fact, it is the same as other usage.