filmov
tv
COMMIT and ROLLBACK Commands in SQL || Lesson 48 || DBMS || Learning Monkey ||

Показать описание
COMMIT and ROLLBACK Commands in SQL
In this class, we will understand COMMIT and ROLLBACK Commands in SQL.
We have already discussed the concepts of ‘UPDATE’ and ‘DELETE’ the values from the tables.
COMMIT and ROLLBACK Commands in SQL
COMMIT Command in SQL
We have already discussed the use of commit in our previous classes.
We use COMMIT to save the changes done permanently.
Once we commit means all the work is permanently saved can’t rollback.
To understand, we will consider the table as shown below.
On the above table, we will update the values as shown below.
UPDATE students SET salary = 600 WHERE name = ‘Vikram’;
Now, we use the commit command to save the work.
All the work saved cannot rollback.
ROLLBACK Command in SQL
ROLLBACK is used to undo the transactions not saved in the database.
The ROLLBACK command is to undo changes since the last COMMIT.
To understand this, we will consider the above table.
We will do two transactions, and we will see what happens after ROLLBACK.
First, we will delete the students whose salary is 600.
One row will get deleted, as shown below.
Next, we will delete all the rows in the table, as shown below.
Now, we will use rollback.
The result table after the rollback is as shown below.
Both the transactions got rolled back.
All the transactions before they commit will get rolled back.
#learningmonkey #dbms #placements #gatecse #gatedbms #campusplacements
Link for playlists:
In this class, we will understand COMMIT and ROLLBACK Commands in SQL.
We have already discussed the concepts of ‘UPDATE’ and ‘DELETE’ the values from the tables.
COMMIT and ROLLBACK Commands in SQL
COMMIT Command in SQL
We have already discussed the use of commit in our previous classes.
We use COMMIT to save the changes done permanently.
Once we commit means all the work is permanently saved can’t rollback.
To understand, we will consider the table as shown below.
On the above table, we will update the values as shown below.
UPDATE students SET salary = 600 WHERE name = ‘Vikram’;
Now, we use the commit command to save the work.
All the work saved cannot rollback.
ROLLBACK Command in SQL
ROLLBACK is used to undo the transactions not saved in the database.
The ROLLBACK command is to undo changes since the last COMMIT.
To understand this, we will consider the above table.
We will do two transactions, and we will see what happens after ROLLBACK.
First, we will delete the students whose salary is 600.
One row will get deleted, as shown below.
Next, we will delete all the rows in the table, as shown below.
Now, we will use rollback.
The result table after the rollback is as shown below.
Both the transactions got rolled back.
All the transactions before they commit will get rolled back.
#learningmonkey #dbms #placements #gatecse #gatedbms #campusplacements
Link for playlists:
Комментарии