- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the TCL commands in DBMS?
Transaction Control language is a language that manages transactions within the database.
It is used to execute the changes made by the DML statements.
Transaction Control Language (TCL) Commands are:
Commit − It is used to save the transactions in the database.
Rollback − It is used to restore the database to that state which was last committed.
Begin − It is used at the beginning of a transaction.
Savepoint − The changes done till savpoint will be unchanged and all the transactions after savepoint will be rolled back.
Given below is an example of the usage of the TCL commands in the database management system (DBMS) −
BEGIN TRANSACTION UPDATE employees SET empname=’bob’ WHERE empid=’001’ UPDATE employees SET empname =’bob’ WHERE city=’hyderabad’ IF @@ROWCOUNT=5 COMMIT TRANSACTION ELSE ROLLBACK TRANSACTION
In the above example after we begin the transaction, we are trying to update the employee’s name with some value of id. If we affect five rows with our first query then, it will COMMIT transaction else It will be ROLLBACK.
Difference between Commit, rollback and savepoint of TCL commands
|1.||Rollback means the database is restored to the last committed state||DML commands saves modification and it permanently saves the transaction.||Savepoint helps to save the transaction temporarily.|
|2.||Syntax- ROLLBACK [To SAVEPOINT_NAME];||Syntax- COMMIT;||Syntax- SAVEPOINT [savepoint_name;]|
|3.||Example- ROLLBACK Update5;||Example- SQL> COMMIT;||Example- SAVEPOINT table_create;|
- What are the DDL commands in DBMS?
- What are the DML commands in DBMS?
- What are the DCL commands in DBMS?
- Data Definition Commands in DBMS
- Data Manipulation Commands in DBMS
- What are Shell Commands?
- What are the different commands used in MySQL?
- What are the Pre-processor Commands in C language?
- What are the components of DBMS?
- What are the applications of DBMS?
- What are the useful commands in JShell in Java 9?
- What are the different types of DBMS?
- What are the states of transaction in DBMS?
- What are the capabilities of DBMS and why relational DBMS is powerful?
- What are the most used SQL clauses in DBMS?