SQL COMMIT is a command used in database management systems to permanently save changes made to a transaction. In other words, the COMMIT statement is used to make sure that the changes made to a database are saved and that they are permanent.
The COMMIT command is usually used in conjunction with the BEGIN TRANSACTION statement, which initiates a transaction. Once a transaction has been initiated using BEGIN TRANSACTION, all changes made to the database during that transaction are temporary and will not be saved until the COMMIT command is issued. Note that there could be one or more SQL statements between BEGIN TRANSACTION and COMMIT.
Let's say we have the following table,
Table Account_Balance
We issue the following SQL:
After executing the above SQL, the table now becomes,
Table Account_Balance
Notice that if you do not include the COMMIT; at the end and your connection is closed, the content of you table would not have changed. In other words, John's balance will remain at 3,500 and Jennifer's balance will remain at 650, even though the two UPDATE statements have been run.
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.