I got two tables, one of which is a helper of the other. The table "reviews" has a column which is an integer referencing to the id of the film of that review in the table "films". Is there a way to, after inserting in the table "films" a new film, use the last_insert_rowid in the table "reviews"?
I'm using SQLITE; I've seen uses with max(id) but it might not be as reliable. Help would be greatly appreciated.
You can just simply use it as a value in your next insert, à la
INSERT INTO films (name) values ('Shark!');
INSERT INTO reviews (filmId,review) values (last_insert_rowid(), 'Good!');
Demo here.