join on 和join where 区别
时间: 2023-10-31 07:40:27 浏览: 43
Join on 和 join where 都是用来连接多个表的 SQL 语句中的关键词。Join on 是指在两个表之间基于某个条件进行连接,将符合条件的记录组合起来。Join where 则是在完成基础连接后再添加一些附加的条件进行筛选,只返回符合条件的记录。简单的说,join on 是用来连接表的,而 join where 则是用来筛选符合条件的记录的。
相关问题
where 和 join on 区别
在使用left join时,on条件是在生成临时表时使用的条件,它不管on中的条件是否为真,都会返回左边表中的记录。而where条件是在临时表生成好后,再对临时表进行过滤的条件。这时已经没有left join的含义(必须返回左边表的记录)了,条件不为真的就全部过滤掉。\[1\]\[2\]
简而言之,on条件是在连接两个表时使用的条件,而where条件是在连接完成后对结果进行过滤的条件。on条件会影响连接的结果,而where条件只会影响最终的查询结果。\[1\]\[2\]
#### 引用[.reference_title]
- *1* [left join inner join on 和where区别](https://blog.csdn.net/qq_36579777/article/details/89412958)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [SQL基础知识:join操作后面的on与where的区别](https://blog.csdn.net/ZYC88888/article/details/112898812)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
join on和where的区别
join on和where的区别在于,join on是用于连接两个表中的数据,而where是用于过滤查询结果中的数据。join on通常用于对两个表中的数据进行联合操作,而where通常用于对查询结果进行筛选和过滤。具体来说,join on是在连接时指定连接条件,将两个表中的数据联合在一起,而where是在查询语句中指定条件,筛选符合条件的数据。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)