当前位置:网站首页>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
边栏推荐
- NC basic usage 2
- Mysql database - basic operation of database and table (II)
- Design of library management database system
- WordPress插件:WP-China-Yes解决国内访问官网慢的方法
- WordPress plug-in: WP CHINA Yes solution to slow domestic access to the official website
- Design of warehouse management database system
- 論文寫作 19: 會議論文與期刊論文的區別
- R language uses timeroc package to calculate the multi time AUC value of survival data under competitive risk, uses Cox model and adds covariates, and R language uses the plotauccurve function of time
- NC basic usage
- Use the rolling division method to find the maximum common divisor of two numbers
猜你喜欢

Servlet learning notes

PHP reference manual string (7.2000 words)

What is the difference between a host and a server?

Numpy mathematical function & logical function

MySQL 进阶 锁 -- MySQL锁概述、MySQL锁的分类:全局锁(数据备份)、表级锁(表共享读锁、表独占写锁、元数据锁、意向锁)、行级锁(行锁、间隙锁、临键锁)
Handwritten Google's first generation distributed computing framework MapReduce

SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions

考研英语唐叔的语法课笔记

Error reported by Azkaban: Azkaban jobExecutor. utils. process. ProcessFailureException: Process exited with code 127

SIGIR'22「微软」CTR估计:利用上下文信息促进特征表征学习
随机推荐
使用 WPAD/PAC 和 JScript在win11中进行远程代码执行3
Cadence Orcad Capture CIS更换元器件之Link Database 功能介绍图文教程及视频演示
还在用 ListView?使用 AnimatedList 让列表元素动起来
DNS cloud school | quickly locate DNS resolution exceptions and keep these four DNS status codes in mind
An error is reported in the initialization metadata of the dolphin scheduler -- it turns out that there is a special symbol in the password. "$“
Leetcode dynamic planning training camp (1-5 days)
R language uses the preprocess function of caret package for data preprocessing: BoxCox transform all data columns (convert non normal distribution data columns to normal distribution data and can not
Record: call mapper to report null pointer Foreach > the usage of not removing repetition;
如何做产品创新?——产品创新方法论探索一
The R language uses the timeroc package to calculate the multi time AUC value of survival data without competitive risk, and uses the confint function to calculate the confidence interval value of mul
R language ggplot2 visual facet_wrap, and use the lineheight parameter to customize the height of the facet icon tab (gray label bar)
Compact CUDA tutorial - CUDA driver API
Local call feign interface message 404
How to create bep-20 pass on BNB chain
R language ggplot2 visualization: ggplot2 visualizes the scatter diagram and uses geom_ mark_ The ellipse function adds ellipses around data points of data clusters or data groups for annotation
Sqoop imports tinyint type fields to boolean type
Is the wechat CICC wealth high-end zone safe? How to open an account for securities
Rédaction de thèses 19: différences entre les thèses de conférence et les thèses périodiques
DNS cloud school rising posture! Three advanced uses of authoritative DNS
PCA based geometric feature calculation of PCL point cloud processing (52)




