oracle常用语句

来源:互联网 发布:黄惠康 知乎 编辑:程序博客网 时间:2024/06/07 18:34

查询登录用户下的所有表 :

 select * from user_tables;


两张相同结构表,查询不同数据(应用场景,临时表定时获取数据,总表有所有数据,临时表增量往总表插入数据)

    select *
  from table_temp tp              --临时表
      where not exists (select *
          from table_total ta     --主表
          where tp.key1 = ta.key1  --主键关联
            and tp.key2 = ta.key2
            and tp.key3 = ta.key3)

---这样就会查询出tp表中比ta表中多出来的数据

0 0
原创粉丝点击