SQL中的主要联接是什么 [英] What are the main join in SQL

查看:75
本文介绍了SQL中的主要联接是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL数据库中的联接是什么?
我已经在goolge中搜索了它,但没有得到足够的结果.
我发现了很多信息.
我对内部联接,外部联接,左侧内部联接,左侧外部联接,右侧内部联接,右侧外部联接等感到困惑.


在此先感谢您.

What are the joins in SQL Database?
I have search it in goolge but not getting sufficient result.
I am founding lot of information.
I am confused in inner join, outer join, left inner join,left outer join,right inner join,right outer join etc..


Thanks in advance.

推荐答案

此处提供的文章可能会帮助您了解不同的联接.

Understanding-SQL-Joins [
Here is an article that might help you understand the different joins.

Understanding-SQL-Joins[^]


请参阅这篇出色的文章在CP上:
SQL联接的可视表示形式 [
See this excellent article on CP :
Visual Representation of SQL Joins[^]

Cheers


很好的问题,但是在谷歌搜索时您应该已经找到了很多答案:)

我通常使用的联接是内部联接和左外部联接.

内部联接=
选择x.column1,y.column1
来自table1 x内部联接
table2 y
在x.id = y.fkid

仅返回table1中匹配项的table1中的帖子

左外连接
选择x.column1,y.column1
来自table1 x左外部联接
table2 y
在x.id = y.fkid

返回table1中的所有帖子,
如果table2中存在匹配项,则将这些结果返回,否则y.column1将为NULL




这是更详细的说明
http://infogoal.com/sql/sql-outer-join.htm [ ^ ]
然后到:
http://en.wikipedia.org/wiki/Join_(SQL) [
Good question, but you should have found loads of answers when googling :)

The joins I usually use are inner join and left outer join.

inner join =
select x.column1, y.column1
from table1 x inner join
table2 y
on x.id = y.fkid

returns only posts from table1 where there is a match in table2

Left outer join
select x.column1, y.column1
from table1 x left outer join
table2 y
on x.id = y.fkid

returns all posts from table1,
and if there is a match in table2 those results will be returned to, otherwise y.column1 will be NULL




here is a more detailed description
http://infogoal.com/sql/sql-outer-join.htm[^]
and here to :
http://en.wikipedia.org/wiki/Join_(SQL)[^]


这篇关于SQL中的主要联接是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆