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)

1 comment:

Mobile App Developers said...

What you're saying is completely true. I know that everybody must say the same thing, but I just think that you put it in a way that everyone can understand. I'm sure you'll reach so many people with what you've got to say.

Popular Posts