当前位置:网站首页>Commit and rollback in DCL of 16 MySQL
Commit and rollback in DCL of 16 MySQL
2022-04-23 20:18:00 【gh-xiaohe】
List of articles
author : gh-xiaohe
gh-xiaohe The blog of
If you think the blogger's article is good , I hope you'll make it three times in a row ( Focus on , give the thumbs-up , Comment on ), Give me more support !!
DCL in COMMIT and ROllBACK
DCL in COMMIT and ROllBACK
COMMIT
COMMIT: Submit data . Once executed COMMIT, The data is permanently stored in the database , This means that data cannot be rolled back .
ROLLBACK
ROLLBACK: Undo Data . Once executed ROLLBACK, Data rollback can be realized . Roll back to the most recent COMMIT after .
contrast
- The same thing : All data in the table can be deleted , While preserving the table structure .
- Difference :
- TRUNCATE TABLE: Once you do this , Clear all table data . meanwhile , Data cannot be rolled back .
- DELETE FROM: Once you do this , All table data can be cleared ( No WHERE). meanwhile , Data can be rolled back .
DDL and DML Explanation
① DDL The operation of Once executed , Just Cannot roll back . Instructions SET autocommit = FALSE Yes DDL Operation failure .( Because at the end of execution DDL After the operation , A certain Will execute once COMMIT. And this COMMIT The operation is not affected by SET autocommit = FALSE Affected .)
② DML By default , Once executed , It's also Non rollback . however , If In execution DML Before , Yes SET autocommit = FALSE, Then the execution of DML Operation can realize rollback .
Case study
COMMIT、DELETE
# demonstration :DELETE FROM #1) COMMIT; #2) SELECT * FROM myemp3; #3) SET autocommit = FALSE; #4) DELETE FROM myemp3; #5) SELECT * FROM myemp3; #6) ROLLBACK; #7) SELECT * FROM myemp3;
COMMIT、 ROLLBACK
# demonstration :TRUNCATE TABLE #1) COMMIT; #2) SELECT * FROM myemp3; #3) SET autocommit = FALSE; #4) TRUNCATE TABLE myemp3; #5) SELECT * FROM myemp3; #6) ROLLBACK; #7) SELECT * FROM myemp3;
MySQL8.0 New features :DDL Atomization of
stay MySQL 8.0 In the version ,InnoDB Tabular DDL Support transaction integrity , namely DDL The operation either succeeds or rolls back .DDL Operation rollback log write to data dictionary Data dictionary table mysql.innodb_ddl_log( The table is a hidden table , adopt show tables Can't see ) in , For rollback operations . By setting parameters , Can be DDL Print and output operation log to MySQL In the error log .
Respectively in MySQL 5.7 Version and MySQL 8.0 Create databases and data tables in version , give the result as follows :
CREATE DATABASE mytest; # Create database mytest USE mytest; # Switch to mytest Under database CREATE TABLE book1( # establish book1 surface book_id INT , book_name VARCHAR(255) ); SHOW TABLES; # View the table under the current data
(1) stay MySQL 5.7 In the version , The test steps are as follows :
# stay mysql5.7 Next DROP TABLE book1,book2; # The database is deleted book1 and book2 Notice that there is no book2 SHOW TABLES;
(2) stay MySQL 8.0 In the version , The test steps are as follows :
# stay mysql8.0 Next DROP TABLE book1,book2; # The database is deleted book1 and book2 Notice that there is no book2 SHOW TABLES;
版权声明
本文为[gh-xiaohe]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204232017307463.html
边栏推荐
- Unity 模型整体更改材质
- selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
- WordPress插件:WP-China-Yes解决国内访问官网慢的方法
- R语言使用caret包的preProcess函数进行数据预处理:对所有的数据列进行BoxCox变换处理(将非正态分布数据列转换为正态分布数据、不可以处理负数)、设置method参数为BoxCox
- PIP installation package reports an error. Could not find a version that satisfies the requirement pymysql (from versions: none)
- 论文写作 19: 会议论文与期刊论文的区别
- PHP reference manual string (7.2000 words)
- Operation of numpy array
- R language uses econocrats package to create microeconomic or macroeconomic map, visualize indifference function indifference curve, customize calculation intersection, and customize the parameters of
- How to protect ECs from hacker attacks?
猜你喜欢

PHP reference manual string (7.2000 words)

After route link navigation, the sub page does not display the navigation style problem

aqs的学习

What is the difference between a host and a server?

波场DAO新物种下场,USDD如何破局稳定币市场?

Unity general steps for creating a hyper realistic 3D scene

Numpy Index & slice & iteration

Building googlenet neural network based on pytorch for flower recognition

Numpy - creation of data type and array

【数值预测案例】(3) LSTM 时间序列电量预测,附Tensorflow完整代码
随机推荐
MySQL 进阶 锁 -- MySQL锁概述、MySQL锁的分类:全局锁(数据备份)、表级锁(表共享读锁、表独占写锁、元数据锁、意向锁)、行级锁(行锁、间隙锁、临键锁)
DTMF dual tone multi frequency signal simulation demonstration system
Software College of Shandong University Project Training - Innovation Training - network security shooting range experimental platform (8)
Alicloud: could not connect to SMTP host: SMTP 163.com, port: 25
SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
Intersection calculation of straight line and plane in PCL point cloud processing (53)
nc基础用法1
Mysql database - single table query (I)
Research on open source OCR engine
The second method of file upload in form form is implemented by fileitem class, servletfileupload class and diskfileitemfactory class.
[target tracking] pedestrian attitude recognition based on frame difference method combined with Kalman filter, with matlab code
Operation of numpy array
【问题解决】‘ascii‘ codec can‘t encode characters in position xx-xx: ordinal not in range(128)
Understanding various team patterns in scrum patterns
Leetcode dynamic planning training camp (1-5 days)
The flinkcdc reports an error: but this is no longer available on the server
R语言使用timeROC包计算无竞争风险情况下的生存资料多时间AUC值、使用confint函数计算无竞争风险情况下的生存资料多时间AUC指标的置信区间值
SIGIR'22「微软」CTR估计:利用上下文信息促进特征表征学习
How to protect ECs from hacker attacks?
如何在BNB鏈上創建BEP-20通證




