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) |