Showing posts with label Syntax for joins. Show all posts
Showing posts with label Syntax for joins. Show all posts

Wednesday, September 10, 2008

Syntax for MySQL joins

JOIN Syntax

MySQL supports the following JOIN syntaxes for the table_references part of SELECT statements.

table_reference, table_reference
table_reference [INNER | CROSS] JOIN table_reference [join_condition]
table_reference STRAIGHT_JOIN table_reference
table_reference LEFT [OUTER] JOIN table_reference join_condition
table_reference NATURAL [LEFT [OUTER]] JOIN table_reference
{ ON table_reference LEFT OUTER JOIN table_reference
ON conditional_expr }
table_reference RIGHT [OUTER] JOIN table_reference join_condition
table_reference NATURAL [RIGHT [OUTER]] JOIN table_reference

table_reference is defined as:

tbl_name [[AS] alias]
[{USE|IGNORE|FORCE} INDEX (key_list)]

join_condition is defined as:

ON conditional_expr | USING (column_list)

Popular Posts