使用auto_increment的前提是该字段必须是一个key(unique key或primary key)

create table t3(
    id int primary key auto_increment,
    name char(6)
);

因为id是自增长的,所以插入记录时只需要插入name

insert into t3(name) values
("egon"),
("csk"),
("alex");

此时删除表需要用 truncate

truncate t3;

如果用delete不能删除自增的ID

相关文章:

  • 2021-12-09
  • 2022-12-23
  • 2021-05-21
  • 2021-10-24
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-16
  • 2021-08-25
  • 2022-03-08
  • 2021-10-04
  • 2021-10-15
  • 2021-12-22
  • 2021-05-18
相关资源
相似解决方案