In the join SQL statement in Mysql, the syntax format of the ON clause is: table1.column_name = table2.column_name.
When the schema design adopts the same naming style for the columns of the joined table, the USING syntax can be used to simplify the ON syntax, with the format: USING(column_name).
For example:
[sql] SELECT f.color, c.is_primary, c.is_dark, c.is_rainbow FROM flags f www.2cto.com INNER JOIN color c ON f.color = c.color WHERE f.country = 'China';
is equivalent to
[sql] SELECT f.color, c.is_primary, c.is_dark, c.is_rainbow FROM flags f INNER JOIN color c USING(color) WHERE f.country = 'China';
The above is the detailed content of How to use JOIN USING in sql to simplify JOIN ON examples. For more information, please follow other related articles on the PHP Chinese website!