当前位置:网站首页>The difference between delete and truncate in DML
The difference between delete and truncate in DML
2022-07-20 19:37:00 【Camellia——】
-- Delete data delete from Table name truncate table Table name
TRUNCATE TABLE tea;
/*
delete and truncate The difference between
delete from Table name : Delete the number of records in the whole table
For growth, the primary key field is not affected id 1,2,3,4,5 Next time insert data into the table id 6
truncate table Table name : Deleted table , Copying an identical table
Leave the self growing primary key field blank , Insert data next time : from 1 It has been increasing since the beginning
*/
DROP TABLE test;
SHOW TABLES;
CREATE TABLE test(
id INT PRIMARY KEY AUTO_INCREMENT,-- Self growing primary key
NAME VARCHAR(20),
gender VARBINARY(10)
);SELECT *FROM test;
INSERT INTO test(NAME,gender)VALUES(' Zhang San ',' male ');
INSERT INTO test(NAME,gender)VALUES(' Lisa ',' Woman ');
INSERT INTO test(NAME,gender)VALUES(' Wang Wu ',' male ');
INSERT INTO test(NAME,gender)VALUES(' Zhao Liu ',' Woman ');DELETE FROM test;-- Just deleted all records
TRUNCATE TABLE test;-- Delete table , Recreate an identical table
边栏推荐
猜你喜欢
微信小程序开发使用onreachBottom实现页面触底加载及分页
DeFi 2.0的LaaS协议Elephant,或许是你熊市下为数不多的获利手段
Cloud machine close_ Reasons and solutions for excessive wait
通俗易懂:MOS管基本知识
jlink 烧写可执行bin程序到mini2440
GL-HSANPs 甘草酸偶联人血清白蛋白包载白藜芦醇/大黄酸磷脂复合物血清蛋白纳米粒的制备
Magichub accent dialogue speech recognition challenge registration begins
Community Shangxin | magichub IO open source this wave of data is quite "Ollie to"
INH-RFP-BSA-NPs载INH和RFP白蛋白纳米粒/载卡巴他赛的白蛋白纳米粒的制备
【转载】pycharm打包.py程序为可执行文件exe
随机推荐
S3c2440 u-boot migration - norflash driver support - s29al016u-boot version: 2008.10 development board: mini2440
About R & D effectiveness
木犀草素甘草酸共轭牛血清白蛋白纳米粒/牛血清白蛋白包覆紫杉醇脂质纳米粒的研究制备
Memory内存操作函数
SSH non secret login
关于GCC编译常用命令
arm汇编—str指令
UML建模工具Visio 、Rational Rose、PowerDesign
DML中delete和truncate的区别
tst、cmp、bne、beq指令
FileBeat6.4 快速上手
uboot-的start.S详细注解及分析
数组的一些经典练习回顾
Arm assembly - BIC, Orr
PDA-RBCs-NPs 聚多巴胺修饰的红细胞-纳米粒子复合/透明质酸包裹马钱子碱牛血清蛋白纳米粒的制备
typedef用法及使用模板
P5023 [NOIP2018 提高组] 填数游戏 题解
谈谈MVC-MVP-MVVM的渐进使用和误解
Arm assembly - STR instruction
关于IO流和String常见的一些面试题