Chinaunix首页 | 论坛 | 博客
  • 博客访问: 97138
  • 博文数量: 45
  • 博客积分: 2500
  • 博客等级: 少校
  • 技术积分: 395
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-15 10:29
文章分类

全部博文(45)

文章存档

2011年(15)

2010年(30)

我的朋友

分类: Oracle

2011-03-01 16:23:34

when we need to use USING clause in the sql?For example in this below:
SELECT emp_name, department_name, city FROM employees e JOIN departments d USING (department_id) JOIN locations l USING (location_id) WHERE salary > 10000;

Can anyone explain what is mean of USING in this sql statement? or USING concept in brief?

Using clause is some thing like that we dont need to mention the join condition when we r retreiveing data from the multiple tables.when we use using clause that particular column name shud present in both the tables and the select query will automatically join those tables using the given column name in USING clause
 

The using clause in Oracle is to support ANSI standard SQL for writing joins.

The same query can be written in the form of

SELECT emp_name department_name city
FROM employees e departments d locations l
WHERE d.department_id = e.department_id
AND d.location_id = l.location_id
AND salary > 10000

In natural joins USING clause can be used to specify only those culomns that should be used for an equijion

阅读(567) | 评论(0) | 转发(0) |
0

上一篇:fork详解 非常好(转载)

下一篇:RBO CBO

给主人留下些什么吧!~~