0

Does join order is determined on mention of table in sequence or on the order of tables in 'on' clause?

Is

select *
  from A 
  left 
  join B 
    on A.id=B.id

same as

select * 
  from A 
  left 
  join B 
    on B.id = A.id

?

Strawberry
  • 33,750
  • 13
  • 40
  • 57
vijay shanker
  • 2,517
  • 1
  • 24
  • 37
  • Yes, the order is determined by which table is 'operand' of JOIN clause only. – raina77ow Jan 10 '18 at 08:11
  • I chose to mark as duplicate because the accepted answers are probably nicer and more helpful than anything you would receive here. If you are really stuck on something, drop a note and someone can reopen the question. – Tim Biegeleisen Jan 10 '18 at 08:14

2 Answers2

1

Yes, although I prefer the second option. It sounds more like natural language to my ear.

Strawberry
  • 33,750
  • 13
  • 40
  • 57
0

They are the same. The logical conditions are commutative. Read here for more insights on MySQL joins.

cdaiga
  • 4,861
  • 3
  • 22
  • 42