skip to main content
Supported SQL functionality : Select : 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
* Where clause
* Group By clause
* Having clause
* Union operator
* Intersect operator
* Except and Minus operators
* Order By clause
* Limit clause