zoukankan      html  css  js  c++  java
  • mysql高级查询

    SQL JOINS 七种理论模型
    1.左外连接(左表独有+右表共有)
      select <select list> from tableA A left join tableB B on A.key=B.key
    2.右外连接(右表独有+左表共有)
      select <select list> from tableA A right join tableB B on A.key=B.key
    3.内连接(左表+右表共有)
      select <select list> from tableA A inner join tableB B on A.key=B.key
    4.左连接(左表独有)
      select <select list> from tableA A left join tableB B on A.key=B.key where B.key is null
    5.右连接(右表独有)
      select <select list> from tableA A left join tableB B on A.key=B.key where A.key is null
    6.全连接(左表全表+右表全表)
      MySQL写法:select <select list> from tableA A left join tableB B on A.key=B.key union select <select list> from tableA A right join tableB B on A.key=B.key
      Oracle写法select <select list> from tableA A full outer join tableB B on.key=B.key
    7.独连接(左表独有或右表独有)
      MySQL写法select <select list> from tableA A left join tableB B on A.key=B.key where A.key is null union select <select list> from tableA A right join tableB B on A.key=B.key where B.key is null
      Oracle写法select <select list> from tableA A full outer tableB B A.key=B.key where A.key is null or B.key is null

  • 相关阅读:
    PHP面试总结
    yii2-dingtalk 钉钉群机器人
    分布式锁机制原理及实现方式
    strtotime的一个使用问题
    JavaScript的程序构成
    libsvm源码凝视+算法描写叙述:svm_train
    android事件分发(二)
    Windows 上通过本地搭建 Jekyll环境
    重点:用户画像
    easyui英文提示变中文
  • 原文地址:https://www.cnblogs.com/linyouyi/p/9939211.html
Copyright © 2011-2022 走看看