I have table autos, In table is column id as auto_increment
AND indexed as primary key
I want reset id, that is I need that ids will be queue from 1
to 2,3,4,5,...
For reset id, I run this query:
ALTER TABLE autos AUTO_INCREMENT = 1
This means that now, maximal id must be equivalent rows count right?
But this code
$res = $db->query("SELECT COUNT(*) AS cnt FROM autos")->fetchAll(PDO::FETCH_ASSOC);
echo "rows count: ".$res[0]['cnt']."<br>";
$res = $db->query("SELECT MAX(id) AS id FROM autos")->fetchAll(PDO::FETCH_ASSOC);
echo "max id".$res[0]['id'];
returns
rows count: 376733
max id: 500000
Why max id and rows quantity not matches? where I am wrong?