zoukankan      html  css  js  c++  java
  • Oracle数据库学习笔记_CREATE TABLE 和 INSERT INTO 的高级用法

    1、新建表

    create table ACCT_LOAN

    (

      data_date      INTEGER not null,  --整数,也可以约束数字最大位数,不可为空

    acct_num       VARCHAR2(35) not null,  --可变长度的字符串(包含数字。字母及特殊字符)

    curr_cd        CHAR(3),  --固定长度为3的字符串(可包含数字,字母及特殊字符)

    drawdown_dt       DATE,  --日期

    loan_amt           decimal(8,2)  --小数,小数最大长度为8位,小数位固定为2位

    2、建备份表

    create table 备份表名 as select * from 表名;

    3、将两张相同结构的表合并在一起

    insert into 表1 select * from 表2 where ...;

    commit;

    4、更新表:merge into

    merge into 表1

    using 表2

    on (表1.字段=表2.字段)

    when matched  then

    update set ...

    when not matched then 

    insert values(表2.xx, 表2.xx,...);

    commit;

    5、给变量赋值

    select into 变量名

    from 

  • 相关阅读:
    js里面的 InttoStr 和 StrtoInt
    预编译知识 (转载记录)
    C语言操作内存
    C语言操作文件
    C语言
    如何调试shell脚本
    设计模式-装饰者模式
    自己动手制作一个模版解析
    设计模式-单例模式
    http中关于缓存的那些header信息
  • 原文地址:https://www.cnblogs.com/tongying/p/13091444.html
Copyright © 2011-2022 走看看