Oracle learning summary (9) - basic operations commonly used by Oracle

Creating a user is equivalent to creating a database in sqlServer 
create user username identified by password 
change user password 
alter user username identified by new password; 
lock account 
alter user username account lock 
unlock account 
alter user username account unlock 
Grant permissions to the user 
grant permission to user 
permission: 
connect: role to connect to the database 
resource: 
log in to the database  using the role of the resource
conn user name/password 
data dictionary table 
user_tables: store user table information 
user_views: store user attempt information 

create table 
create table table name (column name Type constraints,) 
all numbers use number (length, decimal places); 
characters use: varchar2 (length)  date: date, if it is accurate to seconds, there is no automatic growth in oracle 
with datetime  to add columns to the table  alter table table name add column name type  modify database type in  table alter table table name modify column name new type 





delete column 
alter table table name drop column column name 
add primary key 
alter table table name add primary key (primary key column name) 


view table structure 
desc table name 
---------------- view the current user's Table: select * from tab; 
view current user select username from dba_users 

Reprinted in: https://my.oschina.net/zhanghaiyang/blog/606787

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324223322&siteId=291194637