Lesson 9 (Copy)
Lesson 9 (Copy)
Web Programming
Lesson 9
Lesson outline
● Introduction
● DCL – Data Control Language
● TCL – Transaction Control Language
Data Control Language (DCL)
DCL stands for Data Control Language in Structured Query Language (SQL). As
the name suggests these commands are used to control privilege in the
database. The privileges (Right to access the data) are required for performing
all the database operations like creating tables, views, or sequences.
DCL command is a statement that is used to perform the work related to the
rights, permissions, and other control of the database system.
Data Control Language (DCL)
System Privilege
Object Privilege
Data Control Language (DCL)
Commands in DCL
GRANT
REVOKE
SQL: DCL - GRANT
Syntax:
SQL: DCL - REVOKE
REVOKE
This command is used to take permission/access back from the user. If you
want to return permission from the database that you have granted to the
users at that time you need to run REVOKE command.
Syntax:
Data Control Language (DCL)
EXECUTE
UPDATE
SELECT
DELETE
ALTER
ALL
Data Control Language (DCL)
TCL stands for Transaction Control Languages. These commands are used for
maintaining consistency of the database and for the management of
transactions made by the DML commands.
A Transaction is a set of SQL statements that are executed on the data stored
in DBMS. Whenever any transaction is made these transactions are
temporarily happen in database.So to make the changes permanent, we use
TCL commands.
Syntax:
SQL: TCL - ROLLBACK
This command is used to get the data or restore the data to the last savepoint
or last committed state. If due to some reasons the data inserted, deleted or
updated is not correct, you can rollback the data to a particular savepoint or if
savepoint is not done, then to the last committed state.
Syntax:
SQL: TCL - ROLLBACK
This command is used to get the data or restore the data to the last savepoint
or last committed state. If due to some reasons the data inserted, deleted or
updated is not correct, you can rollback the data to a particular savepoint or if
savepoint is not done, then to the last committed state.
Syntax:
SQL: TCL - SAVEPOINT
Syntax:
SQL: TCL - EXAMPLE
By using this command you can update the record and save it permanently by
using COMMIT command.
If commit was not performed then the changes made by the update command
can be rollback.
After Rollback:
SQL: TCL - EXAMPLE
So It was all about TCL commands in SQL (transaction control language) with
examples.
Congratulations!