Mysql ON子句和USING子句

  • Post author:
  • Post category:mysql


ysql ON子句和USING子句

Mysql 中联接SQL语句中,ON子句的语法格式为:table1.column_name = table2.column_name。当模式设计对联接表的列采用了相同的命名样式时,就可以使用 USING 语法来简化 ON 语法,格式为:USING(column_name)。例如:[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’;  等价于[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’;

转载于:https://my.oschina.net/u/3630550/blog/1492130