首先先建立table一、table2两个表进行测试html
建立table1表以及其数据
id name password1
1 11 aa
2 22 bb
3 55 ff
建立table2表以及其数据
id name password2
1 33 cc
2 44 dd测试
使用内链接(inner join...on或join...on)查询table一、table2中的数据
由此结果可发现以下特色:列相连(列相加)htm
使用外链接(left join...on)查询table一、table2中的数据
由此结果可发现以下特色:列相连(列相加),以左表行为准blog
使用右链接(right join...on)查询table一、table2中的数据
由此结果可发现以下特色:列相连(列相加),以右表行为准
使用完整链接(full join...on)查询table一、table2中的数据
test is a bug...
由此结果可发现以下特色:列相连(列相加),以左右表行为准
使用交叉链接(cross join)查询table一、table2中的数据
由此结果可发现以下特色:列行相连(列行相加)——两表的倍数(笛卡尔积运算)get
使用联合(union或union all)查询table一、table2中的数据
由此结果可发现以下特色:行相连(行相加)
联合查询充要条件:
(1)、两表列数需相同。io
(2)、返回结果的仅以第一个查询得到为准。table
(3)、查询中对应的列的数据类型必须隐式一致。
参考连接: https://jingyan.baidu.com/article/e3c78d64afbcce3c4d85f56c.htmltest