Oracle對錶進行的修改操作

2021-10-04 00:28:03 字數 717 閱讀 2052

oracle對錶進行的修改操作,這裡以user表為例 

修改表名:

rename 舊表名 to 新錶名;

rename user to newuser

修改表:

新增新字段:

alter table 表名 add(欄位名 字段型別 預設值 是否為空);

alter table user add(age number(6));

alter table user add (course varchar2(30) default '空' not null);

修改字段:

alter table 表名 modify (欄位名 字段型別 預設值 是否為空);

alter table user modify((age number(8));

修改欄位名:

alter table 表名 rename  column  列名 to 新列名;

alter table user rename column course to newcourse;

刪除字段:

alter table 表名 drop column 欄位名;

alter table user drop column course;

新增注釋:

comment on table user is '使用者資訊表'

comment on column  user.id is '使用者id'

oracle對錶空間進行操作

1.更改資料檔案大小 alter database datafile filename resize 大小 2.向表空間新增資料檔案 alter tablespace 表空間名 add datafile filename size 10 autoextend on 3.表空間唯讀 alter tab...

在oracle中對錶進行分割槽操作

刪除分割槽表 alter table 表名稱 drop partition 分割槽表的名稱 select from user tab partitions d where d.table name bmp customer interaction user tab partitions 當前的使用者...

Oracle 對錶的操作

給表增加字段 alter table 表名 add 欄位名 型別 default 預設值 修改表字段 alter table 表名 modify 要修改的字段 型別 如果你是以a使用者登入資料庫,想檢視a使用者下所有的表,用這個語句 select table name from user table...