Purpose

The From clause indicates the tables to be used in the Select statement.

Syntax

FROM table_name [table_alias] [,...]

where:

table_name
is the name of a table or a subquery. Multiple tables define an implicit inner join among those tables. Multiple table names must be separated by a comma. For example:
SELECT * FROM EMP, DEP
Subqueries can be used instead of table names. Subqueries must be enclosed in parentheses. See "Subquery in a From clause" for an example.
table_alias
is a name used to refer to a table in the rest of the Select statement. When you specify an alias for a table, you can prefix all column names of that table with the table alias.

Example

The following example specifies two table aliases, E for EMP and D for DEP:

SELECT E.NAME, D.DEPTNAME 
FROM EMP E, DEP D
WHERE E.DEPTID = D.ID 

table_alias is a name used to refer to a table in the rest of the Select statement. When you specify an alias for a table, you can prefix all column names of that table with the table alias. For example, given the table specification:

FROM EMP E

you may refer to the LAST_NAME field as E.LAST_NAME. Table aliases must be used if the Select statement joins a table to itself. For example:

SELECT * FROM EMP E, EMP F WHERE E.MGR_ID = F.EMP_ID

The equal sign (=) includes only matching rows in the results.