FROM Clause
- FROM
- Keyword preceding the names of one or more tables, queue tables, views, or derived tables from which expression is to be derived.
Single Table
A FROM clause can include a sequence of single table references.
This action creates an implicit inner join, instead of explicit joins where the keyword JOIN is part of the syntax.
- table_name
- Name of a base table, queue table, global temporary table, volatile table, derived table, or view. If the database is omitted, the system infers it from context.
- AS
- Optional introduction to correlation_name.
- correlation_name
- Optional alias for the table that is referenced by table_name.
Joined Tables
These options enable the FROM clause to specify that multiple tables be joined.
- joined_table
- Name of a joined table, which can be either a single table name with optional alias name, or a joined table, indicating nested joins.
- INNER
- Join in which qualifying rows from one table are combined with qualifying rows from another table according to some join condition.
- OUTER
- Join in which qualifying rows from one table that do not have matches in the other table, are included in the join result along with the matching rows from the inner join. The rows from the first table are extended with nulls.
- LEFT OUTER
- Outer join with the table that was listed first in the FROM clause.
- RIGHT OUTER
- Outer join with the table that was listed second in the FROM clause.
- FULL OUTER
- Rows are returned from both tables
- JOIN
- Introduction to the name of the second table to include in the join.
- ON search_condition
- One or more conditional expressions, including scalar subqueries, that must be satisfied by the result rows.
- CROSS JOIN
- Unconstrained, or Cartesian, join. Returns all rows from all tables specified in the FROM clause. Two joined tables can be cross joined.
- single_table
- Name of a single base or derived table or view on a single table to be cross joined with joined_table.