Module 7 Data Control Language
2026-03-12 19:20
Tags: #ADV_DBMS
Author: Duke Hsu
Key Concept
Controlling Users Access
Privileges in the database - System privileges: Performing a particular action within the database - Object privileges: Manipulating the content of the database objects
System Privileges - More than 100 privileges are available . - The database administrator has high-level system privileges for tasks such as: - Creating news users - Removing users - Removing tables - Backing up tables
Object Privileges - Object privileges vary from object to object. - An owner has all the privileges on the object. - An owner can give specific privileges on that owner's object.
Create users of Database
1 2 | |
Create a User in a Specific Database
1 2 | |
Grant privileges on tables
1 2 3 4 5 6 | |
Creating and Granting Privileges to a Role
1 2 3 4 5 6 7 8 | |
CREATE TABLE - Permission to create new tables in the database.
CREATE VIEW - Permission to create new views in the database .
CREATE SEQUENCE -
CREATE PROCEDUER -
Changing User Password
- The DBA creates your user account and initializes your password.
- You can change your password by using the ALTER USER statement.
1 2 | |
1 | |
Object Privileges
| Object Privileges | Table | View | Sequence |
|---|---|---|---|
| ALTER | ☑ | ☑ | |
| DELETE | ☑ | ☑ | |
| INDEX | ☑ | ||
| INSERT | ☑ | ☑ | |
| REFERENCE | ☑ | ||
| SELECT | ☑ | ☑ | ☑ |
| UPDATE | ☑ | ☑ |
Syntax
1 2 3 4 5 | |
Example:
Grant query privileges on the employees table;
1 2 3 | |
1 2 3 | |
Passing On Your Privileges
Give a user authority to pass along privileges:
1 2 3 4 | |
Allow all users on the system to query data from Alice's DEPARTMENT Table
1 2 3 | |
Revoking Object Privileges
- You use the
REVOKEstatement to revoke privileges granted to other users. - Privileges granted to others through the
WITH GRANT OPTIONclause are also revoked
1 2 3 4 5 | |
Example:
Revoke the SELECTand INSERTprivileges given to thejayvee user on the DEPARTMENTS table
1 2 3 | |
References
Module 7 - Data Control Language PPT