zoukankan      html  css  js  c++  java
  • SQL增加,删除,更改表中字段

    1. 向表中添加新的字段

       alter  table  table_name  add  column_name  varchar2(20) not null

    2. 删除表中的一个字段

        delete table table_name column column_name

    3. 修改表中的一个字段名

       alter table table_name rename column oldname to newname

    4. 添加主键约束
       alter table 表名
       add constraint 约束名 primary key (列名)

    5. 添加唯一约束
       alter table 表名
       add constraint 约束名 unique (列名)

    6. 添加默认约束
       alter table 表名
        add constraint 约束名 default(内容) for 列名

    7. 添加check约束
       alter table 表名
       add constraint 约束名 check(内容)

    8. 添加外键约束
       alter table 表名
       add constraint 约束名 foreign key(列名) references 另一表名(列名)

    9. 删除约束
       alter table 表名
       drop constraint 约束名

    转:http://wgq837051.iteye.com/blog/798766

  • 相关阅读:
    red and black(BFS)
    G
    D
    new word
    CSS Layout
    G
    CSS
    组合数学-母函数
    组合数学-卡特兰数
    cf1144G 将串分解成单调递增和递减子串(贪心)
  • 原文地址:https://www.cnblogs.com/xijin-wu/p/5798464.html
Copyright © 2011-2022 走看看