SQL oracle sql中join关键字和inner join关键字有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15891863/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 14:42:51  来源:igfitidea点击:

what is the difference between join keyword and inner join keyword in oracle sql?

sqloraclejoininner-join

提问by Cici

I can't find documentations on the key word joinbut I saw examples on the web using it.

我找不到有关该关键字的文档,join但我在网上看到了使用它的示例。

I was doing some experiment with it in Oracle hrschema, where I have table departments:

我在 Oraclehr模式中对它进行了一些实验,其中有表departments

  • deparment_name
  • manager_id
  • location_id
  • deparment_name
  • manager_id
  • location_id

A table employees:

一张表employees

  • first_name
  • employee_id
  • first_name
  • employee_id

And table locations:

和表locations

  • location_id
  • city
  • location_id
  • city

Query should return the department_name, first_name of the manager of the department, and the city where the department is located.

查询应返回部门名称、部门经理的名字和部门所在的城市。

The code using the keyword joinseem to return the some result in comparison to using the keyword inner join

与使用关键字join相比,使用关键字的代码似乎返回了一些结果inner join

Code with join:

代码join

select d.department_name, e.first_name,l.city
from departments d
   join employees e on d.manager_id=e.employee_id
   join locations l on d.location_id=l.location_id

Code with inner join:

代码inner join

select d.department_name, e.first_name,l.city
from departments d
   inner join employees e on d.manager_id=e.employee_id
   inner join locations l on d.location_id=l.location_id

Is there a difference between the two condition, or am I just happen to stumble on a situation where they return the same results?

这两种情况有区别吗,还是我只是偶然发现它们返回相同结果的情况?

回答by Sebas

Query expressions 179 7.5 - joined table

3) If a qualified joinis specified and a join typeis not specified, then INNER is implicit.

查询表达式 179 7.5 - 连接表

3) 如果指定了限定连接但未指定连接类型,则 INNER 是隐式的。

  • Following Oracle Standards (9i onward), the INNERprefix is also optional. Before 9i, Oracle didn't follow ANSI rules, and didn't even support JOINsyntax.
  • 按照 Oracle 标准(从9i 开始),INNER前缀也是可选的。在 9i 之前,Oracle 不遵循 ANSI 规则,甚至不支持JOIN语法。