posts - 0, comments - 77, trackbacks - 0, articles - 356
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          oracle alter語句

          Posted on 2008-03-18 20:30 semovy 閱讀(1199) 評論(0)  編輯  收藏 所屬分類: Oracle數(shù)據(jù)庫方面
          create table test(a varchar2(20),b number(2))
          重名命
          alter table test rename to test1
          (rename test1 
          to test2)

          增刪字段


              alter table test2 drop column  f

          修改字段類型和大小
          alter table test2 modify d varchar(40)
          alter table test2 modify f varchar(40)

           

          alter table test2 add  c varchar2(30)
          alter table test2 add  (d varchar2(30),e number(4))
          alter table test2 rename column e  to f

          處理約束

             alter   table   test2     add   constraint   pk_mypri   primary   key   (d,f)
              利用下面的語句在刪除DEPT表中的PRIMARY KEY約束時,同時將刪除其它表中引用這個約束的FOREIGN KEY約束: 
              alter table dept drop primary key cascade
               加foreign key約束(多字段/表級)
              alter table employees   add constraint emp_jobs_fk foreign key (job,deptno) references jobs (jobid,deptno) on delete cascade 
          主站蜘蛛池模板: 泽库县| 锡林浩特市| 罗平县| 连州市| 梅河口市| 江油市| 同心县| 江达县| 盐源县| 南丰县| 成武县| 五原县| 潞西市| 利川市| 右玉县| 普兰县| 巴彦淖尔市| 安顺市| 济阳县| 彩票| 蒙阴县| 安西县| 苍南县| 长葛市| 华池县| 崇礼县| 都昌县| 金堂县| 盐亭县| 安多县| 凤山县| 特克斯县| 高雄市| 鄂温| 蒙自县| 永兴县| 余干县| 天气| 威远县| 建瓯市| 东乌|