Natural join

From Oracle FAQ
Jump to: navigation, search

A natural join is a join statement that compares the common columns of both tables with each other. One should check whether common columns exist in both tables before doing a natural join.

Natural joins may cause problems if columns are added or renamed.

[edit] Examples

This is the same as an equi join on (emp.deptno = dept.deptno):

SELECT dname, ename FROM dept NATURAL JOIN emp

Same query on the HR sample schema:

SELECT department_name, first_name||' '||last_name
  FROM departments NATURAL JOIN employees;

[edit] Also see

Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
Personal tools