mysql AUTO INCREMENT field


  Translation results:

auto

UK[ˈɔ:təʊ] US[ˈɔ:toʊ]

n.<US>Automobile

vi. By car

Third person singular: autos Plural: autos Present participle: autoing Past tense: autoed Past participle: autoed

##increment

英[ˈɪŋkrəmənt ] US [ˈɪnkrəmənt, ˈɪŋ-]

n. Increment; growth; increase; regular salary increase

Plural: increments

mysql AUTO INCREMENT fieldsyntax

Function:Generate a unique number when a new record is inserted into the table

Description:We usually want to automatically generate a unique number every time a new record is inserted into the table. Create the value of the primary key field. We can create an auto-increment field in the table.

mysql AUTO INCREMENT fieldexample

//把 "Persons" 表中的 "P_Id" 列定义为 auto-increment 主键
CREATE TABLE Persons(P_Id int NOT NULL AUTO_INCREMENT,LastName varchar(255) NOT NULL,FirstName varchar(255),Address varchar(255),City varchar(255),PRIMARY KEY (P_Id));

Popular Recommendations

Home

Videos

Q&A