Why are "all" (50350), the last AUTO_INCREMENT id from (59922) and COUNT(*) (59717)?

There is a table InnoDB.
"only" (50350),
the last AUTO_INCREMENT id from (59922)
and COUNT(*) (59717)

Why such a difference in the count and is this normal ?
March 20th 20 at 11:51
1 answer
March 20th 20 at 11:53
Solution
The fact that the AUTO_INCREMENT function is used to generate a unique ID, which will characterize the new (insert string)
A COUNT function to get the number of rows in the sample.

AUTO_INCREMENT ID from the last inserted row is the same as the result from the COUNT function only in case if table is not deleted no rows with data.

The answer to your question:
If they differ, then made deleting rows from a table.
Specifically in your example were removed 59922 - 59717 = 205 records.
Deletions was not exact... just the insert, and before that AUTO_INCREMENT and the whole plate was discarded.

Probably some failed insert without saving in which id lost, it does happen.
MySQL auto-increment skip Id - Noel.Kassulke68 commented on March 20th 20 at 11:56
1)the record was deleted
2)attempt the insert operation without saving loss values of AUTO_INCREMENT - Noel.Kassulke68 commented on March 20th 20 at 11:59
In addition to the previous answers - AUTO_INCREMENT value that will be assigned to the next inserted record can be edited manually.
For example, inserted 200 records, the following records will be assigned ID=201 this value can be changed to 401. And in the end we have lost 200 records. - Zola.Rempel79 commented on March 20th 20 at 12:02

Find more questions by tags MySQL