SQL 左连接和左外连接有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40086630/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
what is the difference between left join and left outer join?
提问by Shree Naath
I have created 2 tables as
我创建了 2 个表作为
CREATE TABLE table1(customerName VARCHAR(20),custid NUMBER ,order_id NUMBER ,price NUMBER );
CREATE TABLE table2(id NUMBER ,salary NUMBER );
Now, I tried to use the queries
现在,我尝试使用查询
SELECT t1.customername,t1.custid,t2.salary FROM table1 t1 left join table2 t2 ON t1.custid = t2.id;
SELECT t1.customername,t1.custid,t2.salary FROM table1 t1 left outer join table2 t2 ON t1.custid = t2.id;
But I get the same output. Is there any difference between them internally in their working ? or are both same!?
但我得到相同的输出。他们在工作中内部有什么区别吗?还是两者都一样!?
回答by Chitharanjan Das
The OUTER
keyword is optional across most popular SQL distributions, which means there is absolutely no difference between a LEFT JOIN
and a LEFT OUTER JOIN
该OUTER
关键字在大多数流行的 SQL 发行版中是可选的,这意味着 aLEFT JOIN
和 a之间绝对没有区别LEFT OUTER JOIN