数据库各种连接的区别
2016-03-27 20:58
363 查看
数据库各种连接区别:
left join,right join,inner join(join)
left join与right join之间是相对的:
基本的例子:select * from table1 t1 left join table2 t2 on t1.col1 = t2.col2;
这个时候查出来的结果是:table1 的全部集合,table2的部分集合
如果想查找table2的全部集合:则可以使用right join:
select * from table1 t1 right join table2 t2 on t1.col1 = t2.col2;
inner join 与join是相同的,查找的是两个表的交集。
select * from table1 t1 inner join table2 t2 on t1.col1 = t2.table2 where t1.id = 1;
相关文章推荐
- 数据库各种连接的区别
- SQL SERVER 中 GO 的用法2
- 数据库的数据类型
- MySql服务器安装
- SQL SERVER 中 GO 的用法
- MySQL创建用户与授权方法
- sparksql与hive整合
- instantClient sqlPlus 连接oracle
- SQL Server 2014 安装图解
- mysql 5.7安装出现的问题。
- ORA-01172,ORA-01151
- Oracle Directory文件夹的知识
- jsp访问mysql登陆验证
- SQL SERVER中架构的理解
- 连接 (SQL)--维基百科
- php+memcached配置
- MySQL学习(二)
- join中连接条件放置位置
- 用Mycat实现从Oracle迁移到Mysql
- sqlsession和sqlsessionFactory区别