8. Inner and Outer Joins: Step 2

Demo

Show all Employee names with their Department location - format 2

Where the field names are the same in both tables, an alternative syntax is:

SQL

SELECT ename, location FROM emp NATURAL JOIN dept;

Output

ename location
CLARK New York
KING New York
MILLER New York
SMITH Dallas
JONES Dallas
SCOTT Dallas
ADAMS Dallas
FORD Dallas
ALLEN Chicago
WARD Chicago
MARTIN Chicago
BLAKE Chicago
TURNER Chicago
JAMES Chicago

Discussion

Care is needed here because this join will be on all fields with the same name in both tables.

Progress

Proceed to Next step