是的,我们可以在没有auto_increment的情况下进行插入,因为它是自动插入的。让我们首先创建一个表-
create table DemoTable1479 -> ( -> EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> EmployeeSalary int -> );
使用插入命令在表中插入一些记录-
insert into DemoTable1479(EmployeeSalary) values(6800); insert into DemoTable1479(EmployeeSalary) values(5600); insert into DemoTable1479(EmployeeSalary) values(5700); insert into DemoTable1479(EmployeeSalary) values(6900); insert into DemoTable1479(EmployeeSalary) values(15000);
使用select语句显示表中的所有记录-
select * from DemoTable1479;
这将产生以下输出-
+------------+----------------+ | EmployeeId | EmployeeSalary | +------------+----------------+ | 1 | 6800 | | 2 | 5600 | | 3 | 5700 | | 4 | 6900 | | 5 | 15000 | +------------+----------------+ 5 rows in set (0.00 sec)