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.用于将可读性不强的字段值变成可读性较强的字段值

  • 相关阅读:
    H5页面尺寸兼容rem
    Mysql索引、explain执行计划
    mysql物理结构
    mysql 架构
    excel 写
    好的开源项目
    批量插入大量数据
    文件下载回显
    shardingsphere 实现 springboot集成 多数据源
    前后端代码特殊符号乱码问题
  • 原文地址:https://www.cnblogs.com/dyshk/p/11578480.html
Copyright © 2011-2022 走看看