join_table:
        table_reference JOIN table_factor [join_condition]
        | table_reference {LEFT OUTER|RIGHT OUTER|FULL OUTER|INNER|NATURAL} JOIN table_reference join_condition
    table_reference:
        table_factor
        | join_table
    table_factor:
        tbl_name [alias]
        | table_subquery alias
        | ( table_references )
    join_condition:
        ON equality_expression ( AND equality_expression )
Note

    • SELECT a.shop_name AS ashop, b.shop_name AS bshop FROM shop a
               
      Note
    • SELECT a.shop_name AS ashop, b.shop_name AS bshop FROM shop a
              RIGHT OUTER JOIN sale_detail b ON a.shop_name=b.shop_name;
    • SELECT a.shop_name AS ashop, b.shop_name AS bshop FROM shop a
              FULL OUTER JOIN sale_detail b ON a.shop_name=b.shop_name;
    • SELECT a.shop_name FROM shop a INNER JOIN sale_detail b ON a.shop_name=b.shop_name;
      SELECT a.shop_name FROM shop a JOIN sale_detail b ON a.shop_name=b.shop_name;
    • SELECT * FROM src NATURAL JOIN src2;
       
      SELECT src.key1 AS key1, src.key2 AS key2, src.a1, src.a2, src2.b1, src2.b2 FROM src INNER JOIN src2 ON src.key1 = src2.key1 AND src.key2 = src2.key2;
    • SELECT * FROM table1, table2 WHERE table1.id = table2.id;
       
      SELECT * FROM table1 JOIN table2 ON table1.id = table2.id;
  •  
    SELECT a. * FROM shop a FULL OUTER JOIN sale_detail b ON a.shop_name=b.shop_name
            FULL OUTER JOIN sale_detail c ON a.shop_name=c.shop_name;
         
    SELECT a. * FROM shop a JOIN sale_detail b ON a.shop_name ! = b.shop_name;  
  • SELECT * FROM src JOIN (src2 JOIN src3 ON xxx) ON yyy;

SELECT s.id
        ,s.name
        ,s.origin
        ,d.value
FROM    test_table_a s
LEFT JOIN   test_table_b d
ON      s.origin = d.id
WHERE   s.ds > "20180101" AND d.ds>"20180101";

SELECT s.id
        ,s.name
        ,s.origin
        ,d.value
FROM  (SELECT * FROM  test_table_a WHERE ds > "20180101" ) s
LEFT JOIN (SELECT * FROM  test_table_b WHERE ds > "20180101") d
ON s.origin = d.id;