Knowledge Point: Mysql basic usage of the business

Source: Internet
Author: User

Transaction

Transactions are used to manipulate multiple SQL for some operations as atomic, and once an error occurs, it can be rolled back to its original state, guaranteeing database data integrity.

Transaction instance:

CREATE TABLE User (IDintPRIMARY Key Auto_increment,nameChar(32), Balanceint) insert into user (Name,balance) VALUES (' Big wood ', 1000),(' Two wooden wood ', 1000),(' Miki ', 1000); #原子操作start transaction;update user Set balance=900 where name= ' large wooden wood '; #买支付100元update User Set Balance=1010 where name= ' two wood wood '; #中介拿走10元update User Set Balance=1090 where name= ' Tri-wood '; #卖家拿到90元commit; #出现异常, roll back to the initial state start transaction;update user set balance=900 where name= ' large wooden wood '; #买支付100元update User Set Balance=1010 where name= ' two wood wood '; #中介拿走10元uppdate User Set Balance=1090 where name= ' Tri-wood '; #卖家拿到90元, the exception did not get rollback; #回到原来的状态commit, MySQL> select *from user;+----+------+---------+| ID | name |  Balance |+----+------+---------+| 1 |    Big Wood Wood |  1000 | | 2 |    Two Wood Wood |  1000 | | 3 |    Miki Wood | |+----+------+---------+3 rows in Set (0.00 sec)

Attached: Mysql basic usage

First, "Mysql Basic usage view"

Second, "Mysql basic usage of the trigger"

Third, "Mysql basic usage of the business"

Iv. "Stored Procedures for Mysql basic usage"

V. "Functions of basic Mysql usage"

Vi. "Mysql Basic usage Process Control"

Knowledge Point: Mysql basic usage of the business

Related Article

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.