oracle表刪除 修改名稱 截斷以及注釋新增

2021-09-12 19:44:31 字數 978 閱讀 4647

1.刪除表

drop table table_name;
eg:

drop table de***0;
2.修改表名稱

修改表名稱有兩種語法格式:

1)alter table table_name rename to new_table_name;

2)rename table_name to new_table_name;

3.截斷資料表

截斷表可以快速刪除表中所有行,oracle會重置表的儲存空間,並且不會在撤銷表空間中記錄任何撤消資料,也就是說無法進行資料撤消。truncate移除後不能回滾,所以建議刪除表中記錄可以用delete語句刪除記錄;

截斷表語法:

truncate table table_name;
eg:截斷person表,刪除表中所有記錄釋放該錶的儲存空間

truncate table person;
4.新增注釋

1)使用comment on table 表名 is注釋內容新增注釋

eg: 為emp表新增注釋

comment on table emp

is 'employee information';

2)查詢表新增的注釋

—all_col_comments

—user_col_comments

—all_tab_commments

—user_tab_comments

語句:

select * from user_tab_comments;

HIVE表建立 刪除 截斷

下文只描述不常見的hive建立 刪除 截斷表的用法 如果不指定資料庫,hive會把表建立在default資料庫下,假設有乙個hive的資料庫mydb,要建立表到mydb,如下 create table mydb.pokes foo int,bar string 或者是use mydb 把當前資料庫指...

oracle表資料修改 刪除

update table set column value column value where condition 1 修改員工smith員工部門編號為30 update emp set deptno 30 where ename smith 2 修改所有部門編號為30的員工部門編號為20 upd...

Oracle(建立 修改 刪除表)

根據rowid獲取某一元組 2 表的建立 1 方式一 create table 2 方式二 當as後面的語句能夠查詢到資料的時候,不僅建立了表的結構而且查詢到的資料也會自動新增到新建立的表內部 查詢表中是否有資料 當as後面的語句不能查詢到資料的時候,只建立表的結構,不會向表中新增資料 3 修改表 ...