ExamVeda
Login
Home
This question belongs to MySQL MySQL Miscellaneous
MySQL Miscellaneous
?

When no AUTO_INCREMENT value has been generated during the current connection, LAST_INSERT_ID() returns . . . . . . . .

Answer & Solution
Correct Answer: Option B
This question is about how MySQL keeps track of the last value generated by the AUTO_INCREMENT feature. AUTO_INCREMENT automatically assigns unique numbers to new rows in a table.

The LAST_INSERT_ID() function is used to get this last generated value. But what happens if no AUTO_INCREMENT value has been created in the current connection?

The answer is Option B: 0.

In other words, if you haven't added any new rows with AUTO_INCREMENT columns, LAST_INSERT_ID() will return 0 because there is no value to retrieve.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.