一、刪除列
alter table aa drop column dep;
適用於小表-----資料量小的時候;
2、alter table aa set unused("dep") cascade constraints;
然後在負載小的時候,刪除
alter table aa drop unused columns;
二、新增列
先加一新字段再賦值:
alter table table_name add mmm varchar2(10);
update table_name set mmm=** ;
三、設定字段值自動增加
insert into t_address (addressname) (select vcname from busstop)
create sequence seq_id_test_increment --序列
increment by 1 start with 1 maxvalue 9999999;
create or replace trigger insert_test_increment --觸發器
before insert on t_address --t_address 表
referencing
new as new
old as old
for each row
begin
select seq_id_test_increment.nextval into :new.addressid from dual; --addressid欄位
end;
MySQL varchar型別自動遞增
delimiter create definer trigger ce myt before insert on ce my3 for each row begin set new.id concat ck lpad select substring id,3,8 from my3 where id...
Oracle PL SQL 設定主鍵自動遞增
oracle沒有設定主鍵auto increment 的功能,需要自己白那些序列和觸發器實現主鍵自動遞增。示例 建立表menu create table menu menuid number 10 not null primary key,name varchar2 40 not null,id p...
oracle主鍵自動遞增設計
1.新建表test increase 欄位為 userid number 10 username varchar2 20 2.新建自動增長序列 seq test autoincrease create sequence test increase sequence increment by 1 每次...