資料處理

1.從其他(或目前)table新增資料到目前table的語法
insert into table_a(id, name) (select id,name from table_b where);

insert into table_a(select * from table_b) //直接將table_b的data全部倒入table_a

2.建立新的table,但是schema要跟某個table一樣
create table table_b as (select * from table_a where 1=2);   //只copy schema
create table table_b as (select * from table_a);                       //copy schema及資料

3.新增欄位名稱 

alter table table_a add (column_b varchar2(1) default 'Y');

 

4.修改欄位名稱 

ALTER TABLE table_a RENAME COLUMN column_b TO column_c;

  


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Big Bear 的頭像
    Big Bear

    Programs Knowledge

    Big Bear 發表在 痞客邦 留言(0) 人氣()