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

          oracle alter語句

          Posted on 2008-03-18 20:30 semovy 閱讀(1204) 評論(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 
          主站蜘蛛池模板: 岳池县| 杭州市| 龙口市| 上蔡县| 奉新县| 探索| 桐乡市| 黄平县| 集贤县| 湖北省| 远安县| 定陶县| 仁寿县| 桑日县| 交口县| 宿州市| 大田县| 南阳市| 淮滨县| 荣成市| 灵璧县| 和田市| 绥江县| 郸城县| 新宾| 宕昌县| 重庆市| 新宁县| 遵化市| 巴东县| 阿鲁科尔沁旗| 菏泽市| 德钦县| 湖口县| 玛多县| 布尔津县| 泰安市| 嘉禾县| 云梦县| 钦州市| 柞水县|