SQLite last_insert_rowid() function
Description
The last_insert_rowid() function returns the ROWID of the last row insert from the database connection which invoked the function.
Note: The last_insert_rowid() SQL function is a wrapper around the sqlite3_last_insert_rowid() C/C++ interface function.
Syntax:
last_insert_rowid()
Example: SQLite last_insert_rowid() function
sqlite> DELETE from table1; sqlite> SELECT * FROM table1; sqlite> INSERT INTO table1 VALUES(1, 'AAA');
SELECT last_insert_rowid();
Sample Output:
last_insert_rowid() ------------------- 1
sqlite> INSERT INTO table1 VALUES(2, 'BBB');
sqlite> SELECT last_insert_rowid();
Sample Output:
last_insert_rowid() ------------------- 2
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/sqlite/core-functions-last_insert_rowid.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics