Join in a From clause
- Last Updated: October 30, 2020
- 1 minute read
- DataDirect Connectors
- ODBC
- Oracle Service Cloud 7.1
- Documentation
Purpose
You can use a Join as a way to associate multiple tables within a Select statement. Joins may be either explicit or implicit. For example, the following is the example from the previous section restated as an explicit inner join:
SELECT * FROM emp INNER JOIN dep ON id=empId
SELECT e.name, d.deptName
FROM emp e INNER JOIN dep d ON e.deptId = d.id;whereas the following is the same statement as an implicit inner join:
SELECT * FROM emp, dep WHERE emp.deptID=dep.id
Syntax
FROM table_name {RIGHT OUTER | INNER | LEFT OUTER | CROSS} JOIN table.key ON search-conditionExample
In
this example, two tables are joined using LEFT OUTER JOIN. T1,
the first table named includes nonmatching rows.
SELECT * FROM T1 LEFT OUTER JOIN T2 ON T1.key = T2.keyIf
you use a CROSS JOIN, no ON expression
is allowed for the join.