COMMIT command in SQL is used to end a transaction and make all changes made within the transaction permanent in the database. A transaction is a series of SQL statements that are executed together as a single unit of work. If any of the statements within a transaction fail, the entire transaction is rolled back and no changes are made to the database.
The basic syntax of the
COMMIT command is as follows:
For example, consider the following SQL statements:
BEGIN TRANSACTION; UPDATE employees SET salary = salary * 1.1 WHERE department = 'Sales'; COMMIT;
In this example, a transaction is started using the
BEGIN TRANSACTION statement. The
UPDATE statement increases the salary of all employees in the Sales department by 10%. The
COMMIT statement is used to end the transaction and make the changes permanent in the database.
It’s important to note that if you don’t use the
COMMIT statement after starting a transaction, the changes made within the transaction will be rolled back and not committed to the database.
In conclusion, the
COMMIT statement in SQL is used to end a transaction and make all changes made within the transaction permanent in the database. The basic syntax of the
COMMIT statement is
Also check WHAT IS GIT ? It’s Easy If You Do It Smart
You can also visite the Git website (https://git-scm.com/)