SQLite Forum

How to get the last row_id in a table without inserting anything
That query assumes that `id` is an explicitly declared rowid.

Substitute the name of the rowid of your target table.  For example, if your table declaration is thus:

create table dingdong
  whapydoodle integer primary key,

then you would `select max(whapydoodle) from dingdong`.

If you do not have an explicitly declared `integer primary key` (rowid) then you would use whatever alias for the rowid is available that has not been declared as a column in your table:  `rowid`, `_rowid_`, or `oid`.

See the fine documentation:  <https://sqlite.org/c3ref/last_insert_rowid.html>