zoukankan      html  css  js  c++  java
  • Oracle——增加修改删除字段

    原文:https://blog.csdn.net/DaneLei/article/details/87986131

    修改字段名语法alter table tableName rename column oldCName to newCName;

    例:alter table student rename column address to addr

    添加字段的语法:alter table tablename add (column datatype [default value][null/not null],….);

    例:alter table student add( grade number(3) default 99 not null) ;

    修改字段的语法:alter table tablename modify (column datatype [default value][null/not null],….);

    例:alter table student modify(grade varchar2(5));

    删除字段的语法:alter table tablename drop (column);

    例:alter table student drop (grade);

    如果修改字段是字符串转数值且原来有数据等其他特殊情况,可以建临时字段过渡

    /*修改原字段名grade为grade_tmp*/
    alter table student rename column grade to grade_tmp;

    /*增加一个和原字段名同名的字段grade*/
    alter table student add grade number(3);

    /*将原字段grade_tmp数据更新到增加的字段grade*/
    update student set grade=trim(grade_tmp);

    /*更新完,删除原字段grade_tmp*/
    alter table student drop column grade_tmp;

  • 相关阅读:
    node.js中常用的fs文件系统
    秒懂 this
    Filter 过滤器
    Ubuntu 安装zookeeper
    Vmware 设置NAT模式
    TreeMap
    ArrayList扩容
    Java 面试题收集
    SwitchyOmega 设置修改代理
    Jedis操作Redis
  • 原文地址:https://www.cnblogs.com/heymonkey/p/12164820.html
Copyright © 2011-2022 走看看