18mysql3
一、内外连接全连接,左右连接
隐式 内连接 select * from a,b where a.列名 = b.列名
select * from a left
outer join b on a.id = b.id
select * from a right outer join b on a.id = b.id
可以使用union来达到全外连接的查询效果。
union :可以将左外连接查询和右外连接查询两条sql语句使用union合并起来进行查询,去掉重复的数据。
内连接:
1、 隐式内连接:
Select * from a,b where a.id = b.id;
结果:C
2、 显示内连接:
Select * from a inner join b on a.id = b.id;
结果:C
外连接:
1、 左外连接
select * from a left outer join b on a.id = b.id
结果:A+C
2、 右外连接
select * from a right outer join b on a.id = b.id
结果:B+C
3、 union:相当于全外连接
select * from a left outer join b on a.id = b.id
union
select * from a right outer join b on a.id = b.id
结果:A+B+C,会自动虑重
select * from a left outer join b on a.id = b.id
union all
select * from a right outer join b on a.id = b.id
结果:A+B+C,有重复数据
<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">
18mysql3的更多相关文章
随机推荐
- java 基础03 继承
- python redis存入字典序列化存储
在python中通过redis hset存储字典时,必须主动把字典通过json.dumps()序列化为字符串后再存储, 不然hget获取后将无法通过json.loads()反序列化为字典 序列化存储 ...
- Python股票分析系列——数据整合.p7
欢迎来到Python for Finance教程系列的第7部分. 在之前的教程中,我们为整个标准普尔500强公司抓取了雅虎财经数据. 在本教程中,我们将把这些数据组合到一个DataFrame中. 到此 ...
- (5)学习笔记 ) ASP.NET CORE微服务 Micro-Service ---- 熔断降级(Polly)
一. 什么是熔断降级 熔断就是“保险丝”.当出现某些状况时,切断服务,从而防止应用程序不断地尝试执行可能会失败的操作给系统造成“雪崩”,或者大量的超时等待导致系统卡死. 降级的目的是当某个服务提供者发 ...
- JS实现一个v-if
// 获取dom var el = document.getElementById('root'); console.log(el); // 遍历dom function dealNode(el) { ...
- c++继承实例
#include <iostream> #include <vector> #include <string> using namespace std; class ...
- Java Core - JVM运行时内存管理
在读正文之前,阅读以下两篇博客学习并理解堆栈.作用域.本地方法的概念. 作用域:https://www.cnblogs.com/AlanLee/p/6627949.html 操作数栈:https:// ...
- Windows10下安装VMware虚拟机并搭建CentOS系统环境
转载: http://blog.51cto.com/10085711/2069270 操作系统 Windows 10专业版(64位) VMware虚拟机 产品:VMware® Workstation ...
- myecplise ssh项目配置上遇到的问题
版本:spring3.1+hib4.1+struts2.1 学习项目使用此版本运行时,总是会遇到各样的错误,在这里做一下记录. 问题1:log4j相关 spring的web项目,执行时报错: 信息: ...
- JSON for-in 遍历
(代码均以js代码示例) 1.可以使用 for-in 来循环对象的属性,使用中括号([])来访问属性的值: 这中方法便于一些在不确定有属性的情况下使用. var myObj = { "nam ...