How to create and manage user in SQL
How to create new account in database.
1.To create new account we have to login as system.
2.We have to execute the command using by following syntax.
Syntax - create user user_name identified by password;
Example - create user technical identified by tech123;
3.grant command
Syntax - grant create session to user_name;
Example - grant create session to technical;
4.Login to new user.
connect user_namepassword - *****
Example - conn technical
password - tech123
User creation is done.
How to see list of user present in database..?
command is -
select *from all_users;
How to list all users in ascending and descending order.
Order by clause - order by clause is use to arrange the data in ascending or descending order when the syntax is order by column name ASC,DESC.
Syntax -
order by column_name[ASE/DESC];
1.Ascending order
I.
select *
from all_users
order by user_id;
II.
select *
from all_users
order by user_id ASC;
2. Descending order
select *
from all_users
order by user_id DESC;
How to delete the user.
- connect to system user (conn system).
- Use drop command.
Syntax - drop user user_name
Spool -
1.Create folder and copy the path of folder.
2. Open Software and login as any user(scoot).
3.Execute following command. - spool "C:\Users\Mahesh\Desktop\SQL\query.txt";
4.Execute set of query.
5.spool off.
Output file -
0 Comments