22

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

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

  • deparment_name
  • manager_id
  • location_id

A table employees:

  • first_name
  • employee_id

And table locations:

  • 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 join seem to return the some result in comparison to using the keyword inner join

Code with 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:

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?

Hash
  • 4,647
  • 5
  • 21
  • 39
Cici
  • 1,407
  • 3
  • 13
  • 31
  • 1
    asked before and answered: http://stackoverflow.com/questions/565620/difference-between-join-and-inner-join This isn't a critism on your post. It's an indication that this has been asked before and has a quality answer there. – xQbert Apr 09 '13 at 01:38
  • @xQbert: not about oracle though – zerkms Apr 09 '13 at 01:38
  • @xQbert: so? What that answer is based on? Does oracle obliged to behave like sql server? You want to refer to a generic question - find one about ANSI SQL – zerkms Apr 09 '13 at 01:40
  • @Community: the referred question **IS NOT** a duplicate, it's about another RDBMS which isn't assumed to behave similarly. – zerkms Apr 09 '13 at 01:41
  • @xQbert: His answer (even though it's short and without any documentation based proofs) - is a particular answer for a particular question. Your reference - is a question about another RDBMS. And if you don't know both - you cannot say, if you may follow it or not. – zerkms Apr 09 '13 at 01:52

1 Answers1

26

Query expressions 179 7.5 - joined table

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

  • Following Oracle Standards (9i onward), the INNER prefix is also optional. Before 9i, Oracle didn't follow ANSI rules, and didn't even support JOIN syntax.
Sebas
  • 21,192
  • 9
  • 55
  • 109