join sql查询中where和子句的区别 [英] Difference between where and and clause in join sql query

查看:36
本文介绍了join sql查询中where和子句的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下两个 SQL 查询有什么区别

What is the difference between following two SQL queries

select a.id, a.name, a.country 
from table a 
left join table b on a.id = b.id
where a.name is not null

select a.id, a.name, a.country 
from table a 
left join table b on a.id = b.id and a.name is not null

推荐答案

基于以下两个测试结果

select a.id, a.name,a.country from table a left join table b
on a.id = b.id
where a.name is not null 

更快(237 Vs 460).据我所知,这是一个标准.

is faster (237 Vs 460). As far as I know, it is a standard.

这篇关于join sql查询中where和子句的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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