Gustavo, as comments, it is not advisable to reuse code in a column with auto-increment.
However, if you come across a situation where you need to restart or set a new increment value, use the following command:
ALTER TABLE Curso AUTO_INCREMENT = 1;
In this case, the next records entered in the Course table will have the Ids incremented from 1.
You can also change the Records ID manually with an UPDATE, as commented by Leo Caracciolo.
If the table already has records, I suggest that the auto-increment value defined is the MAX+1 of the column, thus avoiding the violation of the unicity restriction in the insertion of the next records.
It’s not a good idea to reuse id, especially if you have related tables.
– rray
The best practice is not to delete but to mark as deleted, invalid etc., recovering the sequence is bad because it would be difficult to reorder all dependent tables as stated above.
– Motta
It makes total sense what you said. VLW
– GDPS
The question is "Is it possible to make it occupy the ID = 1, which in theory is vacant?" The answer is YES, UPDATE Course SET id='1' Where id='2' however ....
– user60252