Specify Tables with the from Clause

The from clause is required in every select statement that retrieves data from tables or views. Use it to list all the tables and views containing columns included in the select list and in the where clause.

If the from clause includes more than one table or view, separate them with commas.

At most, a query can reference 250 tables and 46 worktables (such as those created by aggregate functions). The 250-table limit includes: For more information, see Reference Manual: Commands.

The full naming syntax for tables and views is always permitted in the from clause:


However, the full naming syntax is required only if there is potential confusion about the name.

To save typing, you can assign table names correlation names. Assign the correlation name in the from clause by giving the correlation name after the table name, like this:

select p.pub_id, p.pub_name 
from publishers p 

All other references to that table (for example, in a where clause) must also use the correlation name. Correlation names cannot begin with a numeral.

Related concepts
Databases and Tables