本文介绍了sql中的ON子句和using子句之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一些与oracle中的联接有关的任务.在某些方面,我坚持认为,即USING和ON子句之间有什么区别.

I am doing some assignment related to joins in oracle.In some point I stucked i.e. what is the difference between USING and ON clause.

我知道使用ON子句可以连接无限的表.可以使用USING子句联接无限表吗?你能用例子解释一下吗?

I know that using ON clause we are able to join unlimited tables. Is it possible to join unlimited tables using USING clause?how?could you explain it by using example.

推荐答案

  • USING子句:这使您可以按名称指定连接键.

    • The USING clause: This allows you to specify the join key by name.

      ON子句:此语法使您可以为两个表中的联接键指定列名.

      The ON clause: This syntax allows you to specify the column names for join keys in both tables.

      USING子句

      ON子句

      Oracle

      select department_name, city
      from departments
      JOIN locations
      USING (location_id); -- specify the same column name 
                           -- for both of the tables for the join
      select department_name, city
      from departments dept
      join locations loc
      on (dept.location_id = loc.id); -- specify different column name 
                                      -- for the tables for the join.
      

      这篇关于sql中的ON子句和using子句之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 11:49