Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In the ANSI standard, <code>on</code> is required for all join types except <code>cross join</code>. This applies to Oracle and most other databases.</p> <p>MySQL is a bit different. This is the syntax diagram in the MySQL <a href="http://dev.mysql.com/doc/refman/5.5/en/join.html" rel="nofollow">documentation</a>:</p> <pre><code>join_table: table_reference [INNER | CROSS] JOIN table_factor [join_condition] | table_reference STRAIGHT_JOIN table_factor | table_reference STRAIGHT_JOIN table_factor ON conditional_expr | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_factor </code></pre> <p>That is, MySQL allows the <code>on</code> to be optional for <code>join</code>, but not <code>left outer join</code> or <code>right outer join</code>. MySQL does not support <code>full outer join</code>. And, to make it more confusing <code>cross join</code> is like <code>join</code> and <em>can</em> accept an <code>on</code> clause.</p> <p>And, you should ignore the MySQL extensions. <em>Always</em> use an <code>on</code> clause for left, right, and inner joins. <em>Never</em> use an <code>on</code> clause for <code>cross join</code>. I prefer using these to the <code>natural join</code> (which you don't ask about), because I prefer to be explicit in the columns being used for the join.</p> <p>EDIT:</p> <p>According to <a href="http://www.sqlfiddle.com/#!9/d41d8/270" rel="nofollow">SQL Fiddle</a>, version 5.6 gets an error on <code>full outer join</code> when <code>left outer join</code> works. So this generates an error:</p> <pre><code>select * from (select 1 as a) t1 full outer join (select 2 as b) t2 on t1.a = t2.b; </code></pre> <p>This also generates an error:</p> <pre><code>select * from (select 1 as a) t1 full join (select 2 as b) t2; </code></pre> <p>And MySQL documentation (through 5.7) is all very clear that <code>full join</code> is not supported. I'm not sure why your query might have worked.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload