DBMS Assignment 4 Writeup
DBMS Assignment 4 Writeup
DCL:
DCL is Data control Language which includes the command used by DBA for user
creation, assigning or removing privileges.
1. Create a user
Syntax:
Create user <user_name> identified by <assign a Password>
2. Display Usernames
Syntax:
Select username from DBA_users;
3. To display privileges of a specific user
Syntax:
Select * from DBA_sys_privs
Where grantee=<user>;
4. To Assign Privilege to User
Syntax:
grant <privilege> to <user>;
5. To Revoke privilege
Syntax:
Revoke <privilege> from <users>;
TCL:
Transaction control language:- These commands are basically used for managing and
controlling the transactions in a database.
A set of SQL statements executed on the data stored in the DBMS is known as a
transaction. Following commands are used to control transactions.
a) Commit: This command helps a user to save a given transaction into the database
permanently. When using a DML command like DELETE, UPDATE or INSERT the alterations
made are not permanent until one closes the current session.
Meaning ,the changes can rollback if one does ‘t store data permanently. Thus, to avoid it we
use the commit command. It makes these changes permanent.
Syntax:
COMMIT;
b) Rolback: This command restores the database to the last committed restores
the database to the last committed state or to the specified Savepoint.
Syntax:
1. ROLLBACK;
Restores the database to the last commit;
2. ROLLBACK to Savepoint name
Restores the database to the specified Savepoint.
c) Savepoint: This command helps in saving a database state temporarily. So that a user can
easily rollback to that point as and when required.
Syntax:
SAVEPOINT <Savepoint_name>
EX: SAVEPOINT A;