zoukankan      html  css  js  c++  java
  • UNION ALL UNION

    (一)UNION ALL UNION 的用法和区别

      UNION UNION    ALL
    用途   用于使用SELECT语句组合两个或多个表的结果集。 用于使用SELECT语句组合两个或多个表的结果集。
    区别 结果不包含重复行 结果包含重复行
    注意     每段select语句返回的列必须具有相同或可转换的数据类型,大小和相同的顺序。 同左



      

    (二)

    a.union all

    SELECT '1' code, '新建' name FROM dual
    UNION all
    SELECT '2' code, '处理中' name FROM dual
    UNION all
    SELECT '3' code, '关闭' name FROM dual
    union all
    select '3' code,'关闭' name from dual

    b.union

    SELECT '1' code, '新建' name FROM dual
    UNION
    SELECT '2' code, '处理中' name FROM dual
    UNION
    SELECT '3' code, '关闭' name FROM dual
    union
    select '3' code,'关闭' name from dual

     (三) 业务需要

    a.用于使用SELECT语句组合两个或多个表的结果集。

    b.用于将可读性不强的字段值变成可读性较强的字段值

  • 相关阅读:
    bzoj2751
    bzoj1483
    bzoj1011
    bzoj1412
    bzoj1820
    bzoj1295
    bzoj3444
    Java--Exchanger用于进行线程间的数据交换
    Java--Semaphore控制并发线程数量
    Java--Spring AOP 源码散点记录(最后整理成一篇博客)
  • 原文地址:https://www.cnblogs.com/dyshk/p/11578480.html
Copyright © 2011-2022 走看看