How To Get Id Of Last Inserted Row In Mysql

[Solved] How To Get Id Of Last Inserted Row In Mysql | Php - Code Explorer | yomemimo.com
Question : mysql id of inserted row

Answered by : caleb-mcnevin

-- For mysql
INSERT INTO table_name (col1, col2,...) VALUES ('val1', 'val2'...);
SELECT LAST_INSERT_ID();

Source : https://stackoverflow.com/questions/17112852/get-the-new-record-primary-key-id-from-mysql-insert-query | Last Update : Tue, 10 Mar 20

Question : how to get id of last inserted row in mysql

Answered by : samuel-liebert

mysql> select *from LastInsertedRow where Id=(SELECT LAST_INSERT_ID());

Source : https://www.tutorialspoint.com/access-last-inserted-row-in-mysql | Last Update : Sun, 22 May 22

Question : mysql get last insert id

Answered by : arjun-nurdin

SELECT MAX(id) AS last_id FROM users
-- last_id --
-- 33 --

Source : | Last Update : Tue, 20 Jul 21

Question : mysql get last inserted id

Answered by : jessica-koekemoer

-- To get the last inserted auto-increment row ID: --
SELECT LAST_INSERT_ID( optional_expression )
-- If you have just inserted it using a command in C# use: --
int lastId = (Int32)yourCommand.LastInsertedId;

Source : | Last Update : Fri, 22 May 20

Answers related to how to get id of last inserted row in mysql

Code Explorer Popular Question For Php