1
SQL Fundamental II
==================================================================================== //* Lession 1 Controling User *// ==================================================================================== create user amit identified by amit; select username,account_status from dba_users; connect amit/amit(connect permission to amit is not available) connect satish/satish grant connect,resource to amit; create role manager; grant connect,resource,create table,create view to manager; grant manager to amit; alter user amit identified by kumar; grant select on panchkurwa to amit; grant update on panchkurwa to amit; grant delete on panchkurwa to amit; grant select,insert on panchkurwa to amit with grant option; select grantee,granted_role from dba_role_privs where grantee='AMIT'; select grantee,granted_role from user_tab_privs_recd where grantee='AMIT'; desc USER_TAB_PRIVS_RECD; select owner,table_name,privilege from user_tab_privs_recd where owner='AMIT'; select * from user_tab_privs_recd; revoke select on panchkurwa from amit; revoke manager from amit; select grantee,granted_role from dba_role_privs where grantee='AMIT'; ==================================================================================== //* Lession 2 Managing Schema Object *// ==================================================================================== create table ruby (sno number(2) constraint ruby_sno_pk primary key ,color varchar2(25) constraint ruby_col_uk unique); insert into ruby values(&1,'&redish'); select * from ruby; //* alter table add,modify,drop table *// alter table ruby add (price number(4)); desc ruby; update ruby set price=4000 where sno=1; commit; alter table ruby modify (sno number(3),color varchar2(20),price number(5)); desc ruby; alter table ruby drop (price); desc ruby; alter table ruby add (price number(5)); alter table ruby modify (price number(4)); desc ruby; alter table ruby drop column price; desc ruby; clear screen; alter table ruby add (price number(4)); SQL Fundamental II