Question

how can I let sql/mysql set the next id, that I have no problems with posts at the same time?

Was it helpful?

Solution

CREATE TABLE Persons
(
ID int NOT NULL AUTO_INCREMENT,
LastName varchar(255) NOT NULL,
FirstName varchar(255)
)

Auto_Increment can be used as ID as there wont any duplicate value.
When insert value for the table :

INSERT INTO Persons (FirstName,LastName)
VALUES ('Hello','World')

The table will look like this.

ID | FirstName | LastName
1  |   Hello   |  World
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top