테이블 truncate 및 delete 차이점 비우기

1319 단어 sqlmysql


mysql     truncate delete  

        truncate  ,  delete  truncate   
       mysql          。

truncate table mytable;

  truncate    ,  id 1   。

      

create table `user` ( 
`id` int(11) not null auto_increment,
`name` varchar(100) default null,
 primary key (`id`))
 
      

insert into user (name) values ('bob');
insert into user (name) values ('mark');
insert into user (name) values ('alex');
insert into user (name) values ('julia');

       

select * from user; the result is:id         name                                                                                                                                                                                                                                    1          bob        2          mark
  3          alex        4          julia 

   truncate  

truncate table user;

      

insert into user (name) values ('bill');

    

select * from user;
the result is:id         name              1          bill
delete   

delete  from user;

좋은 웹페이지 즐겨찾기