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
  • 相关阅读:
    Python使用 odbc、jdbc与 Object Relational Mapping (ORM)进行数据库开发
    Tensorflow安装
    学生作业
    大学课程推荐
    人工智能的开发工具
    android开发
    jdbc-odbc桥
    开博随记
    利用jq实现自适应边缘情况的气泡Tip
    一篇完整的FlexBox布局指南
  • 原文地址:https://www.cnblogs.com/zuiyue_jing/p/11868345.html
Copyright © 2011-2022 走看看