You are on page 1of 3

SQL Assignment 9

1. Differentiate between System Privilege and Object Privilege with appropriate example.

System privilege covers privileges on acess and use of system level database

Where as object privilege covers acess and use of objects.

System privilege is based on operation where as object privilege based on operation and

object.

2. What is schema? Explain with appropriate example.

Schema is named collection of objects.eg.table,view,session

3. What is the difference between CREATE TABLE and CREATE ANY TABLE?

Explain with appropriate example.

Create any table-system privilege eg.select any table

Create table-object privilege eg.select on hr.employees

4. Which privilege is required to create a user in Oracle?

Create user(system privilege)

5. Which privilege is required to login to the database as a user in Oracle?

Create session

6. Which view is used to display the list of system privileges assigned to a user?

User_sys_privs

7. Write the syntax to grant CREATE TABLE and CREATE SESSION privilege to

SCOTT and USER?


Grant create table,create session to scott,user.

8. What is role and what is the advantage of using it?

Role is named group of privileges assigned to users;

By using it,role can be granted to users instead of writing the privileges in role again and

again.

9. Write syntaxes to create a role as TEST_ROLE, then to grant CREATE TABLE and

CREATE PROCEDURE privilege to that role and finally to grant that role to user HR

and SPRINT.

Create role TEST_ROLE;

Grant CREATE TABLE, CREATE PROCEDURE to TEST_ROLE;

Grant TEST_ROLE to hr,SPRINT;

10. A single Role can contain both system privileges and Object privileges (TRUE/FALSE).

true

11. A user can change his/her own Password (TRUE/FALSE).

true

12. What is the syntax to change the password of a user?

Alter user username identified by password;

13. What is the importance of WITH GRANT OPTION during object privilege granting in

Oracle? Explain with appropriate example.

If WITH GRANT OPTION is used,then grantee can further grant the privileges which

are granted by grantor to other users;

Grant all on emp to sonu with grant option;

Grant all on hr.sonu to user10 ;


14. What is the importance of keyword PUBLIC during privilege granting in Oracle?

Explain with appropriate example.

By using keyword public,the privileges are made accessible to all uses.

Grant create table to public;

15. Write the syntax to grant update privilege on DEPARTMENT_ID and

DEPARTMENT_NAME column of DEPARTMENTS table to HR.

Grant update on departments(department_id,department_name) to hr;

16. Which view is used to display the list of roles granted to a user?

User_role_privs.

17. Which view is used to display the list of object privileges granted to a user?

User_tab_privs.

18. Write the syntax to revoke all privileges granted on DEPARTMENTS table from

SCOTT and SPRINT.

Revoke all on departments from SCOTT,SPRINT;

You might also like