zoukankan      html  css  js  c++  java
  • oracle更新语句merge和update

    update:

         update语句更新需要根据索引或者数据列遍历所有行

         语句举例:

         update table1  a set column1=(select column from table2 b where a.col=b.col)

    merge:merge只需要遍历一次表,,可以更新可以插入

        语句举例:

        merge into table1 a

        using (select col1,co2 from table2 where col3 条件) table2 on a.colm=table2.colm --链接条件

        when matched then

        update  set a.colu=table2.column

        delete where (table2.col>5000) --只删除满足条件的语句

        when not matched then

        insert into a (a.colu1,a.colu2) valus(table2.col1,table2.co2) where (table2.colu<5000) --插入满足条件的语句

      

  • 相关阅读:
    索引优化策略
    mysql列类型选择
    redis安装
    redis相关面试题
    aop动态代理源码分析
    JVM运行时数据区
    redis应用场景
    JPA相关知识
    技术栈
    linux上安装mysql5.6
  • 原文地址:https://www.cnblogs.com/wind-man/p/5669531.html
Copyright © 2011-2022 走看看