Inserting into multiple tables with multiple rows into a table in sqlite -
i want insert 2 tables @ time. this needs done way. insert single row 1 table, auto incremented primary key , insert multiple rows other table, using primary key value got first table reference. what best way this? sqlite has built-in last_insert_rowid() function, return value change after next insertion. you have read value in program, , insert manually: db.execute("insert people(name) values (?)", ["joe"]) id = db.last_insert_rowid db.execute("insert pets(owner, name) values (?,?)", [id, "fluffy"]) db.execute("insert pets(owner, name) values (?,?)", [id, "spot"])