List DCL and TCL commands.
In : IMCA Subject : Introduction to RDBMSDCL – Data Control Language
These commands are used to manage user permissions and access in the database.
**GRANT** | Gives users access privileges to database objects (like tables, views, etc.)
**REVOKE** | Removes previously granted privileges from users
Example:
GRANT SELECT ON Employees TO User1;
REVOKE INSERT ON Employees FROM User1;
TCL – Transaction Control Language
These commands are used to **manage transactions** (i.e., groups of SQL operations treated as a single unit) in the database.
**COMMIT** | Saves the changes made in a transaction permanently to the database
**ROLLBACK** | Undoes the changes made in a transaction (reverts to the last committed state)
**SAVEPOINT** | Sets a point in a transaction that you can roll back to later without rolling back the entire transaction
**SET TRANSACTION** | Sets properties for a transaction, like isolation level or read/write mode
Example:
BEGIN; -- or START TRANSACTION;
DELETE FROM Employees WHERE ID = 101;
UPDATE Accounts SET Balance = Balance - 5000 WHERE AccID = 201;
COMMIT; -- saves both actions
-- OR
ROLLBACK; -- cancels both actions