0
点赞
收藏
分享

微信扫一扫

delete 和truncate的区别

-- 先创建一张表

create table `test`(

  `id` int(4) not null auto_increment,

  `coll` varchar(20) not null,

  primary key(`id`)

)engine = innodb default charset = utf8

 

-- 插入数据

insert into `test`(coll`) values('1'),('2'),('3')

 

delete from `test` -- 不会删除表的自增,不影响表的自增

 

truncate table `test` --自增会归零


举报

相关推荐

0 条评论