8. SQL Statements : SELECT (interactive) : Syntax for Specifying Tables and Views
 
Share this page                  
Syntax for Specifying Tables and Views
The syntax rules for specifying table names in queries also apply to views.
To select data from a table you own, specify the name. To select data from a table you do not own, specify schema.table, where schema is the name of the user that owns the table. However, if the table is owned by the database DBA, the schema qualifier is not required. You must have the appropriate permissions to access the table (or view) granted by the owner.
A correlation name can be specified for any table in the FROM clause. A correlation name is an alias (or alternate name) for the table. For example:
SELECT... FROM employees e, managers m...
The preceding example assigns the correlation name "e" to the employees table and "m" to the managers table. Correlation names are useful for abbreviating long table names and for queries that join columns in the same table.
If a correlation name is assigned to a table, the table must be referred to by the correlation name. For example:
Correct:
SELECT e.name, m.name
FROM employees e, managers m...
Incorrect:
SELECT employees.name, managers.name
FROM employees e, managers m...