There are two basic syntaxes for inserting records
| Category | Detailed explanation |
|---|---|
| Basic syntax | insert into table values(value 1, value 2, value n); |
| Example | INSERT INTO user values(2,'php中文网','male') |
| Example description | Into the user table The inserted value id is 2, the name is Li Wenkai, and the gender is male |
| Detailed explanation | |
|---|---|
| insert into table (field 1, field 2, field n) values (value 1 , value 2, value n); | |
| INSERT INTO user(id,username,sex) values(213,'小Shenyang',1); | |
| Insert the id 213 into the user table, the username is Xiaoshenyang, and the gender is 1 |
| id | username | password | sex | ||
|---|---|---|---|---|---|
| Chinese description | NumberUsername | Password | gender | ||
| Type description | intvarchar(50) | varchar(60) | varchar(32) | tinyint | |
| Default value description | Auto-incrementRequired | Optional field, the default value is | 123@php.cn | Optional fieldRequired field |