SQL control transactions-usage of the commit command

Source: Internet
Author: User

CommitCommandTransactionsSave the modification to the database.CommitOrRollbackAll transactions after the command are saved to the database.

The syntax of this command is: Commit
[Work];
Keywords Commit Is the only indispensable part of the syntax, followed by the characters or commands used to terminate the statement. The specific content depends on different implementations. Keywords Work Is an option, its only role is to make the command more user-friendly.
In the following example Product_tmp Start of all data in:
Select * From products_tmp;
Prod_id
Prod_desc
Cost
12345 witches
Costume 1, 29.99
222 false paraffin
Teeth 1.1
13
Plastic (pumpkin 7.75)
90 lighted
Lanterns
14.5

4 rows selected.
Next, delete all 14.00 .
Delete from products_tmp
Where cost <14;
2 rows deleted.
Use one Commit Statement to save the modification to the database. Transactions .
Commit;
Commit complete.
Warning the database should be used more for large-scale data loading or revocation. Commit Statement; however, too many Commit The statement will take a lot of extra time to complete the work.

Remember, all modifications are first sent to the temporary rollback area. If the temporary rollback area has no space and you cannot save the changes made to the database, the database may be suspended and further modification is prohibited.TransactionsOperation.
Note: In some implementations, transactions do not useCommitCommand submission is triggered by the database exit operation.

However, in some implementations, suchMySQL, In the executionSettransactionAfter the command, the database receivesCommitOrRollbackPreviously, the automatic submission function will not be restored.




 

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.