Home > database >  Guan yu LAST_INSERT_ID () data display problems
Guan yu LAST_INSERT_ID () data display problems

Time:05-15

With the following statement to create a new table
The create table child_list (chilNo char (2), id int primary key auto_increment, name char (10), the age char (2), sex char (5));
Then insert insert into child_list (chilNo, name, age) values (LAST_INSERT_ID (), 'Tom', 17).

Then show in the table is


Very strange why here is 3, then continue to insert two data

Insert into child_list (chilNo, name, age) values (LAST_INSERT_ID (), "Jimmy", 17).
Insert into child_list (chilNo, name, age) values (LAST_INSERT_ID (), 'King', 19).

At this time in the table shows, it can be seen from the second record is the insertion order began to arrange, so want to consult the first a insert to produce the 3 said what meaning, thank you

  • Related