MySQL 8 Deprecates VALUES(col) Function and Updates INSERT ... ON DUPLICATE KEY UPDATE Syntax
MySQL 8 removes the VALUES(col) function, requiring developers to use an alias with INSERT INTO ... VALUES (...) AS alias and to reference columns via alias.col in ON DUPLICATE KEY UPDATE, while also changing AUTO_INCREMENT and auto‑update column behaviors.
The VALUES function is deprecated in MySQL 8; developers should replace it with an alias using INSERT INTO ... VALUES (...) AS alias and refer to columns via alias.col in the ON DUPLICATE KEY UPDATE clause.
New syntax examples illustrate the replacement (images in the original source show the syntax).
If a table contains an AUTO_INCREMENT column and INSERT ... ON DUPLICATE KEY UPDATE inserts or updates a row, the LAST_INSERT_ID() function returns the AUTO_INCREMENT value.
An auto‑updated column remains unchanged if all other columns are set to their current values; to force an update, explicitly set it to the desired value such as CURRENT_TIMESTAMP .
References: MySQL worklog tasks 13325, 6312, and the official documentation at https://dev.mysql.com/doc/refman/8.4/en/insert-on-duplicate.html.
Cognitive Technology Team
Cognitive Technology Team regularly delivers the latest IT news, original content, programming tutorials and experience sharing, with daily perks awaiting you.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.