使用内部,左侧和右侧连接时的总计数 [英] Total count when using inner, left and right joins

查看:84
本文介绍了使用内部,左侧和右侧连接时的总计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面提到的场景我有



表A

Empid

1

1

2

2

2

3

3 br />
3



表B

Empid

1

2

3



所以当使用内部加入,左加入和右加入时总数将是多少



我尝试了什么:



我认为,内部联接有9行,左联有3行行,右连接有3行。请提供解释建议。

解决方案

提供的示例数据,所有三个连接将有九行,因为在任一个表中没有行而没有相应的行其他表。



视觉表示SQL连接 [ ^ ]

Below mentioned scenario I have

Table A
Empid
1
1
2
2
2
3
3
3

Table B
Empid
1
2
3

so what will be total count when using Inner join, left Join and Right join

What I have tried:

I think, Inner join have 9 rows, Left join have 3 rows, right join have 3 rows. Please suggest with explanation.

解决方案

With the sample data provided, all three joins will have nine rows, since there are no rows in either table without a corresponding row in the other table.

Visual Representation of SQL Joins[^]


这篇关于使用内部,左侧和右侧连接时的总计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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