Let's say I have this simple table:
CREATE TABLE some_table (
id INT(11) PRIMARY KEY AUTOINCREMENT,
name VARCHAR(20)
);
with this INSERT statement :
INSERT INTO some_table (name) VALUES ("Foo"), ("Bar"), ("Buz");
The result gives me (for example) :
fieldCount = 0
affectedRows = 3
insertId = 18
info = 'Records: 3 Duplicates: 0 Warnings: 0',
serverStatus = 2
warningStatus = 0
Upon executing SELECT statement, I see that the first inserted row has the insertId = 18
; is it guaranteed that the subsequent inserted document have their id in sequence?
In other words, is it guaranteed that the follow SELECT would yield the following rows?
SELECT * FROM some_table WHERE id >= 18 LIMIT 3
id | name
------+--------------
18 | Foo
19 | Bar
20 | Buz
And if this result is not guaranteed, will a transaction guarentee it then?
And if a transaction does not guarantee it, is it possible to retrieve the individual id values in sequence?