為表增加新列 不改變表結構和資料

2021-06-27 00:36:42 字數 741 閱讀 2855

--(1)

--oracle 新增字段:

alter table 表名 add (欄位名 型別 空否 ...);

--oracle 刪除字段:

alter table 表名 drop column 欄位名;--最好不要有資料

--oracle 修改字段:

alter table 表名 modify (欄位名 型別 空否 ...); --改型別/名字最好不要有資料

comment on column 表名.欄位名 is '這裡填寫注釋';

新增表名注釋:comment on tabel 表名 is '這裡填寫注釋';

--(2)

--資料量不大

alter table tbl_name add (欄位名 型別 空否 ...);

--如果資料比較多,下面這樣可能更好:

create table tbl_newname(.......); --新錶中包含新增加的性別等字段

--[create synonym tbl_newname for cux.tbl_newname;]

insert into tbl_newname(name,address) 

select * from tbl_name;

drop table tbl_name;

rename tbl_newname to tbl_name;

select vale1, value2 into table2 from table1

不改變鍊錶結構逆序輸出鍊錶

方式一 author jueying 類說明 author jueying public class goodboy class node public int data 值 public node next next指標 c語言中 前插法建立鍊錶 1.p head.next 頭節點的下乙個結點賦值...

PLSQL匯出表結構和資料

b size large 一 匯出表結構 size b size large 1 命令視窗輸入 sql set serveroutput on sql set long 999999 sql set feedback off sql spool temp.sql sql select dbms me...

Oracle備份表結構和資料

建立乙份表結構 create table base goodspayment setting bak as select from base goodspayment setting 將資料插入到備份表中 insert into base goodspayment setting bak selec...