T Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='ins_duplicate'; +----------------+ | Auto_increment | +----------------+ | 5 | +----------------+ INSERT INTO ins_duplicate VALUES (2,'Leopard') ON DUPLICATE KEY UPDATE animal='Leopard'; Query OK, 2 rows affected (0.00 sec) SELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='ins_duplicate'; +----------------+ | Auto_increment | +----------------+ | 5 | +----------------+ INSERT INTO ins_duplicate VALUES (5,'Wild Dog') ON DUPLICATE KEY UPDATE animal='Wild Dog'; Query OK, 1 row affected (0.09 sec) SELECT * FROM ins_duplicate; +----+----------+ | id | animal | +----+----------+ | 1 | Antelope | | 2 | Leopard | | 3 | Zebra | | 4 | Gorilla | | 5 | Wild Dog | +----+----------+ SELECT Auto_increment FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='ins_duplicate'; +----------------+ | Auto_increment | +----------------+ | 6 | +----------------+ Refering to column values from the INSERT portion of the statement: INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6) ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b); See the VALUES() function for more. URL: https://mariadb.com/kb/en/insert-on-duplicate-key-update/https://mariadb.com/kb/en/insert-on-duplicate-key-update/