MySQL Commit and rollback

Source: Internet
Author: User

From the functional partition, the SQL language can be divided into three categories: Ddl,dml and DCL.
1. DDL (Data Definition Language)
A data definition language that defines and manages the language of all objects in a SQL database;
Create---Table
Alter---modify a table
Drop---Delete table
2. DML (Data manipulation Language)
Data manipulation language, SQL processing data and other operations are collectively referred to as data manipulation language;
Insert---Data
Delete---Deletion of data
Update---Modification of data
Query for SELECT---data
3. DCL (Data Control Language)
Data Control language, which is used to grant or reclaim some privileges of accessing the database, and to control the time and effect of database manipulation transactions, and to monitor the database;
Grant---authorization.
ROLLBACK---rollback.
Commit---commit.

4. There are three types of submission data: explicit commit, implicit commit, and auto-commit.

these three types are described below.

(1) Explicit submission

commits that are completed directly with the commit command are explicitly committed.
(2) Implicit submission

commits that are indirectly completed with SQL commands are implicitly committed. These commands are:

ALTER, AUDIT, COMMENT, CONNECT, CREATE, DISCONNECT, DROP, EXIT, GRANT, Noaudit, QUIT, REVOKE, RENAME.

(3) automatic submission

if Autocommit is set to ON, the system commits automatically after inserting, modifying, and deleting statements, which is automatic submission. The format is: Sql>set autocommit on;
Be careful when commit/rollback these two commands. Commit/rollback are used after the DML statement (insert/delete/update/select) is executed. DML statements, after execution, the processed data is placed in the rollback segment (except for the SELECT statement), waiting for the user to commit (commit) or rollback (ROLLBACK), and when the user executes commit/rollback, the data placed in the rollback segment is deleted.

(after the SELECT statement executes, the data has a shared pool.) When it is provided to other people to query the same data, it is extracted directly in the shared pool and no longer extracted from the database, which improves the speed of data query. )
All DML statements are explicitly committed, meaning that a commit is executed after the DML statement is executed. Others, such as DDL statements, are implicitly committed. That is, after running those non-DML statements, the database has been implicitly committed, such as CREATE table, after running the script, the table has been built, and does not need you to explicitly commit.

The transaction can be rolled back with rollback before committing the transaction (commit).

MySQL Commit and rollback

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.