zoukankan      html  css  js  c++  java
  • Oracle 修改表 Alter Table...

    --增加列
    ALTER TABLE Student add sex number(2);
    --删除列
    ALTER TABLE Student drop column sex;
    --更改列属性
    ALTER TABLE Student modify city number(2);
    --更改默认值
    ALTER TABLE Student modify sex default 1;
    --增加表主键
    ALTER TABLE Student add constraint stu_pk primary key(student_id);
    --增加表外键
    ALTER TABLE Student add constraint stu_ref
    foreign key(school) references school(schoolid);
    --更改非空约束
    ALTER TABLE Student modify sname not null;
    --增加检查约束
    ALTER TABLE Student add constraint check_stu_age check (age>10);
    --增加唯一性
    ALTER TABLE Student add constraint uqe_phone unique (phone);
    --删除约束
    ALTER TABLE Student drop constraint uqe_phone;
    --约束失效
    ALTER TABLE Student disable constraint uqe_phone;
    --约束复效
    ALTER TABLE Student enable constraint uqe_phone;
    --修改表名
    ALTER TABLE Student RENAME TO Student2
    --修改表列名
    ALTER TABLE Student RENAME COLUMN phone TO phoneno
    --表备注 Add comments to the table
    comment on table STUDENT
    is '学生';
    --字段备注 Add comments to the columns
    comment on column STUDENT.sname
    is '姓名';

  • 相关阅读:
    回到顶部
    angularjs 复选框 单选框
    关于angularjs的ng-repeat指令
    JS字符串对象
    JS的控制语句与异常
    JS的运算符
    JS的引入方式和基础规范
    z-index及透明度opacity,利用overflow设置头像
    css的定位
    css的float属性及清除浮动
  • 原文地址:https://www.cnblogs.com/walkwithmonth/p/6306793.html
Copyright © 2011-2022 走看看