Domanda

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

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top