The FROM
clause
The FROM
clause specifies the source(s) from which the data are to be retrieved.In its simplest form, this is a single table or view.However, the source can also be a selectable stored procedure, a derived table, or a common table expression.Multiple sources can be combined using various types of joins.
This section focuses on single-source selects.Joins are discussed in a following section.
SELECT ... FROM <table-reference> [, <table-reference> ...] [...] <table-reference> ::= <table-primary> | <joined-table> <table-primary> ::= <table-or-query-name> [[AS] correlation-name] | [LATERAL] <derived-table> [<correlation-or-recognition>] | <parenthesized-joined-table> <table-or-query-name> ::= table-name | query-name | [package-name.]procedure-name [(<procedure-args>)] <procedure-args> ::= <value-expression [, <value-expression> ...] <derived-table> ::= (<query-expression>) <correlation-or-recognition> ::= [AS] correlation-name [(<column-name-list>)] <column-name-list> ::= column-name [, column-name ...]
Argument | Description |
---|---|
table-name |
Name of a table or view |
query-name |
Name of a CTE |
package-name |
Name of a package |
procedure-name |
Name of a selectable stored procedure |
procedure-args |
Selectable stored procedure arguments |
derived-table |
Derived table query expression |
correlation-name |
The alias of a data source (table, view, procedure, CTE, derived table) |
column-name |
Name or alias for a column in a relation, CTE or derived table |