Tags
MySQL
Asked 1 years ago
30 May 2022
Views 337
jagdish

jagdish posted

how to use LAST_INSERT_ID() in MySQL

how to use LAST_INSERT_ID() in MySQL ?
jabber

jabber
answered May 31 '22 00:00

LAST_INSERT_ID() is MySQL function which return last insert id ,
example :


insert into products set name='Titan watch';
select LAST_INSERT_ID() 


so in the above query, after inserting the product at the products table, the next query return the last inserted id in the products tables, products should id with auto-increment value.
Post Answer