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 '姓名';

  • 相关阅读:
    es6之更优雅的条件语句
    html 提取 公用部分
    jQuery 新添加元素事件绑定无效
    关于ie6块元素行内元素转换
    git 入门级使用
    vim入门级使用
    git安装配置
    学习使用mac
    Angular常用标记
    npm/bower/brew
  • 原文地址:https://www.cnblogs.com/walkwithmonth/p/6306793.html
Copyright © 2011-2022 走看看