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 约束名

  • 相关阅读:
    JS数组分页
    UI框架
    mongodb
    koa2 router中间件的三种写法
    Float浮点数转二进制串和十六进制串
    Iterator和for...of循环
    mysql相关故障
    lsof
    iostat测试磁盘性能
    dd测试磁盘
  • 原文地址:https://www.cnblogs.com/lcword/p/6396170.html
Copyright © 2011-2022 走看看