zoukankan      html  css  js  c++  java
  • Oracle DQL+DML总结

    查询语句

    1、不等查询

    select * from tableA where name <> '费哥';
    

    2、交叉连接(笛卡尔积)

    select * from tableA cross join tableB on xxx;
    

    3、IN ANY ALL查询

    select * from tableA where age > all(select age from tableB where name='研发部');
    

    4、左外连接

    select * from tableA left join tableB on xxx;
    

    5、全外连接(左连接和右连接去重)

    select * from tableA full join tableB on xxx;
    

    6、内连接

    select * from tableA inner join tableB on xxx;
    

    7、联合查询(union:对两个结果集进行并集操作,不包括重复行)

    select * from tableA
    union all  
    select * from tableB
    

    8、分组查询

    select dept,avl(age) from tableA group by dept having avl(age)>20;
    

    9、树级查询

    select * from tableA start with 条件1
        connect by prior 条件2
        where 条件3;
    1、条件1 是根结点的限定语句,当然可以放宽限定条件,以取得多个根结点,实际就是多棵树。
    2、条件2 是连接条件,其中用prior表示上一条记录,比如org_id = parent_id就是说上一条记录的org_id是本条记录的parent_id。
    3、条件3 是过滤条件,用于对返回的所有记录进行过滤。
    

    更新语句

    1、普通更新

    update tableA set name='费哥';
    

    删除语句

    1、普通删除

    delete from tableA;
    

    2、全表删除

    truncate table tableA;
    

    插入语句

    1、普通插入

    insert into tableA (name,age) values('feige',36);
    

    2、批量插入

    insert into tableA
        select name,age from tableB;
    
  • 相关阅读:
    10-2[RF] OOB validation
    5.css背景以及书写位置
    4.css基础
    3.表单form
    2.表格
    1.html基础
    正则表达式
    协程
    7.树与树算法
    6.排序与二分查找
  • 原文地址:https://www.cnblogs.com/feiqiangsheng/p/13770402.html
Copyright © 2011-2022 走看看