zoukankan      html  css  js  c++  java
  • MySQL的排序方式

    MySQL中 进行排序的方式:

    Select * from 表名 [where 条件 order by  字段名(默认的是ASC升序排列)]

    ASC是升序排列,DESC用来指定降序排列

    Oracle中子查询:

    Select * from 表名 where 条件 (select * from 表名 where 条件)

     

     

    实例:

    in: select * from emp where deptno in (select deptno from dept where loc = 'DALLAS' or loc = 'BOSTOM');
    all: select * from emp where sal > all(select sal from emp where ename = 'JAMES' or ename = 'FORD');
    any: select * from emp where sal > any(select sal from emp where ename = 'JAMES' or ename = 'FORD');
    exists: select * from emp where exists (select sal from emp where ename = 'JAMES' or ename = 'FORD');

    union操作用于计算两个结果集的并集,它在取并集时会自动去掉结果集的重复行。
    select * from emp where sal <= 1600 union select * from emp where sal >= 1500;
    intersect操作于计算两个结果集的交集
    select * from emp where sal <= 1600 intersect select * from emp where sal >= 1500;
    minus操作用于计算两个结果集的差集(只返回在第一个结果集中存在,但在第二个集中不存在的数据)
    select * from emp where sal <= 1600 minus select * from emp where sal >= 1500;

    其他方法:

     

     

  • 相关阅读:
    python之面向对象
    python之异常处理
    python之函数的使用
    python之模块的使用
    python之循环语句
    python之文件操作
    初识Python
    python爬虫之request模块详解
    pikachu之文件上传
    pikachu靶场之暴力破解
  • 原文地址:https://www.cnblogs.com/darui/p/8595222.html
Copyright © 2011-2022 走看看