Progress
SQL-92
Guide and Reference


FROM Clause

Specifies one or more table references. Each table reference resolves to one table (either a table stored in the database or a virtual table resulting from processing the table reference) whose rows the query expression uses to create the result table.

SYNTAX

FROM table_ref [, table_ref ] ... [ { NO REORDER } ] 

table_ref

There are three forms of table references:

FROM table_name [ AS ] [ alias [ ( column_alias [ ... ] ) ] ]

Explicitly names a table. The name can be a table name, a view name, or a synonym.

alias

A name used to qualify column names in other parts of the query expression. Aliases are also called correlation names.

If you specify an alias, you must use it, and not the table name, to qualify column names that refer to the table. Query expressions that join a table with itself must use aliases to distinguish between references to column names.

Similar to table aliases, the column_alias provides an alternative name to use in column references elsewhere in the query expression. If you specify column aliases, you must specify them for all the columns in table_name. Also, if you specify column aliases in the FROM clause, you must use them, and not the column names, in references to the columns.

FROM ( query_expression ) [ AS ] [ alias [ ( column_alias [ ... ] ) ] ]

Specifies a derived table through a query expression. With derived tables, you must specify an alias to identify the derived table.

Derived tables can also specify column aliases. Column aliases provide alternative names to use in column references elsewhere in the query expression. If you specify column aliases, you must specify them for all the columns in the result table of the query expression. Also, if you specify column aliases in the FROM clause, you must use them, and not the column names, in references to the columns.

FROM [ ( ] joined_table [ ) ]

Combines data from two table references by specifying a join condition.

SYNTAX
{ table_ref CROSS JOIN table_ref  
  | table_ref [ INNER | LEFT [ OUTER ] ] JOIN  
    table_ref ON search_condition  
} 

The syntax currently allowed in the FROM clause supports only a subset of possible join conditions:

{ NO REORDER }

Disables join order optimization for the FROM clause. Use NO REORDER when you choose to override the join order chosen by the optimizer. The braces are part of the syntax for this optional clause.

EXAMPLE

For customers with orders, retrieve their names and order info:

SELECT customer.cust_no, customer.name, orders.order_no,orders.order_date 
     FROM customers, orders 
     WHERE customer.cust_no = orders.cust_no ; 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095