Order of rows on inserting multiple rows
I have table with AUTO_INCREMENT column. Now I insert multiple rows with one INSERT.
CREATE TABLE animals (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO animals (name) VALUES
('dog'),('cat'),('penguin'),
('lax'),('whale'),('ostrich');
Is it truth that rows get AUTO_INCREMENT value in order they are specified in query? Can I rely on this behaviour in my code to map new ids to values i inserted?
I haven't found implicit answer on this question in documentation..
Subject
Written By
Posted
Order of rows on inserting multiple rows
December 10, 2018 08:24AM
December 10, 2018 10:36AM
December 11, 2018 02:50AM
December 11, 2018 01:59PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.