skip to main content
Reference : Supported SQL Statements and Extensions : Select : Select Clause : From Clause
  

Try DataDirect Drivers Now
From Clause

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.
* Outer Join Escape Sequences
* Join in a From Clause
* Subquery in a From Clause