The MySQL column auto_incrementmaintains the number inside and always increments it even after deletion. If you need to fill in the empty space, you should process it yourself in PHP, and not use the keyword auto_incrementin the table definition.
, , .
auto_increment reset SQL, , .
ALTER table AUTO_INCREMENT=12345;
, , :
FOREIGN KEY (friendid) REFERENCES registration_table (id) ON DELETE SET NULL;
. , , . , PHP. mysql_insert_id() .
, , .
SELECT MAX(id) FROM registration_table;