oracle對使用者 表 欄位的基本操作

2021-08-20 17:13:15 字數 1346 閱讀 1124

1.建立使用者並設定密碼

create user username identified by password ;

2.修改使用者密碼

alter username

identified by password ;

3.刪除使用者

drop user username

4.賦予使用者許可權

賦予使用者所有許可權:

grant all privileges to username;

賦予使用者部分許可權:

grant connect to username;

grant resource to username;

grant create snapshot to username;

grant create synonym to username;

grant create table to username;

grant create view to username;

grant select any table to username;

grant create any trigger to username;

grant create any view to username;

grant select any dictionary to username;

grant unlimited tablespace to username;

5.新增表

create table sys_log (

log_id nvarchar2(36) not null,

create_time number(13) default null,

constraint pk_logid primary key (log_id)

--指定主鍵

);6.為表的某個字段新增索引

create index createtime_index

--索引名稱

on sys_log

--表名

(create_time

--欄位名

);7.插入資料

insert into sys_log (log_id,create_time) values('1',1528787854000);

8.修改某個字段允許為空

alter table 表名 modify 欄位名 字段型別 null;

9.增加字段

alter table sys_file add(

ip nvarchar2(20) default null

);comment on column sys_file.ip is '上傳人的ip';

Oracle操作表,字段

0.建立表 create table table name as select from table name b 1.oracle 修改表名 alter table old table name rename to new table name 大寫為系統命令 2.oracle通過altertab...

oracle修改表字段

增加字段 alter table docdsp add dspcode char 200 刪除字段 alter table table name drop column column name 修改字段型別 alter table table name alter column column nam...

Oracle表,字段,列操作

1 新增字段 alter table student add age number 5 2 修改字段 alter table student modify age number 10 alter table table2 rename column result to result2 3 刪除字段 ...