I'm inserting multiple rows like so:
INSERT INTO table (col_a,col_b) VALUES (111,'example'),
(222,'another example'),(333,'blah'),(444,'another blah'),(555,'aldksjf')
Neither col_a
or col_b
are primary keys. My primary key has an auto_increment
on it, let's call it table_id
.
I've come across this link which indicates that I can use LAST_INSERT_ID
and ROW_COUNT
to determine the table_id
of my previous inserts.
My question is order guaranteed? Specifically, if LAST_INSERT_ID
is 15 is 15 guaranteed to have values (111,'example')
and will table_id 18 guaranteed to have (444,'another blah')
? Or does it simply mean that the 5 inserted rows will have ids 15 - 19 but not necessarily in the order of the values section of my statement.