zoukankan      html  css  js  c++  java
  • 修改表和约束

    (一)修改表列

    语法:alter table [schema_name.]table_name

    {

      add column_name data_type [column_attributes] |

      drop column column_name |

      modify column_name data_type [column_attributes]

    }

    1 新增表列

    alter table invoice_check add invoice_name varchar2(200);

    2 修改表列

    alter table invoice_check MODIFY invoice_name varchar2(100) CHECK(LENGTH(invoice_name) <= 50);

    3 删除表列

    alter table invoice_check DROP COLUMN invoice_name;

    4 重命名表列

    alter table invoice_check RENAME COLUMN invoice_name TO invoice_name_short;

    (二) 修改约束

    语法:alter table table_name

    {

      add constraint constraint_name constraint_definition [DISABLE] |

      drop constraint constraint_name  |

      enable [novalidate] constraint_name   |

      DISABLE  constraint_name

    }

    1 添加约束

    alter table invoice_check ADD CONSTRAINT invoice_check_pk PRIMARY KEY (invoice_id);

    2 删除约束

    alter table invoice_check DROP CONSTRAINT invoice_check_pk;

    3 启用/ 禁用 约束

    alter table invoice_check ENABLE CONSTRAINT invoice_check_pk;

    alter table invoice_check DISABLE CONSTRAINT invoice_check_pk;

  • 相关阅读:
    AndroidStudio小技巧--依赖库
    仿iOS Segmented Control样式"
    Metaweblog在Android上使用
    正则表达式使用技巧
    flask中gunicorn的使用
    Git用法小记
    指定GPU训练模型
    python中grpc的使用示例
    如何用LaTex编辑数学公式
    keras使用多进程
  • 原文地址:https://www.cnblogs.com/ly01/p/8509001.html
Copyright © 2011-2022 走看看