zoukankan      html  css  js  c++  java
  • Oracle使用——Oracle表字段的增加、删除、修改和重命名

    增加字段

    • 语法
      alter table tablename add (column datatype [default value][null/not null]);
    • 说明:alter table 表名 add (字段名 字段类型 默认值 是否为空);[ ]内参数可选
    • 例子
      alter table test_user add (userName varchar2(20) default '管理员' not null);
    • Next

    修改字段

    • 语法
      alter table tablename modify (column datatype [default value][null/not null]);
    • 说明:alter table 表名 modify (字段名 字段类型 默认值 是否为空);[ ]内参数可选
    • 例子
      alter table test_user modify (userName varchar2(50) default '超级管理员' not null);
    • Next

    删除字段

    • 语法
      alter table tablename drop (column);
    • 说明:alter table 表名 drop 字段名
    • 例子
      alter table test_user drop (userName);
    • Next

    字段重命名

    • 语法
      alter table tablename rename column column1 to column2;
    • 说明:alter table 表名 rename  column  列名 to 新列名
    • 例子
      alter table test_user rename column userName to user_name;
    • Next

    表的重命名

    • 语法
      alter table tablename rename to tablename1;
    • 说明:alter table 表名 rename to  新表名
    • 例子
      alter table test_user rename to test_user_simple;
    • Next
  • 相关阅读:
    1069.查找学生信息
    1023.Excel排序
    1061.成绩排序
    bzoj 1113
    bzoj 1112 treap树
    bzoj 1225 dfs + 一点点数论
    bzoj 1224
    UESTC
    HDU 3530 单调队列
    bzoj 1233
  • 原文地址:https://www.cnblogs.com/zuiyue_jing/p/11868345.html
Copyright © 2011-2022 走看看