Wednesday, August 11, 2021

SQL Query Examples

The ORDER BY clause last in the SELECT statement

 

select last_name, job_id, departmet_id, hire_date from emp order by hire_date;



Create the user SQL Statement


create user user_name

identified by password;


*********************************************************************************

User System Privileges:-

After a user is created, the DBA can grant specific system privileges to the user.


      grant privilege [privilege] to user [user_name/role,public--];


Typical User Privileges:-




Granting system Privileges:-

The DBA can grant specific system privileges to a user’s.


 grant create session, create table, create sequence, create view to user_name(demo);



*********************************************************************************

SQL statement, privileges for insert data in to the table on.


      alter user sony(user name)

          quota unlimited on users;


***********************************************************************************


Creating a Role:-

Role is a named group of related privileges that can be granted to users.

A user can have access to several roles, and several user can be assigned the role.

Role are typically created for a database application.

     

create table, create view to role_name;


Grant privileges to a role:-

    create table, create view to role_name;


Grant a role to users:-

 grant role_name to user_name;

grant select on scott.emp to user_name;


As a admin privileges at a one time.

        grant select, insert, update, reference, alter, index, delete

           on scott.emp to role_name;

****************************************************************************************************

Changing your password

 alter user_name

    identified by password;


§  Grant privileges to update specific columns to user and roles.

  grant update (department_name, locaton_id

    on departments to demo, manager;


§  Revok statement is removing privileges of role, user, database


 revoke select, insert on departments from demo; 


Drop the unused column:-

alter table emp     

drop unused column;;






No comments:

Post a Comment