FROM clause
Syntax
SELECT ...
FROM {
[<schema_name>.]<table_name>
[ [ AS ] <alias_name> ]
| <subquery>
[ [ AS ] <alias_name> ]
}
[ JOIN ... ]
Parameters
-
[<schema_name>.]<table_name>
Specifies the name of the object (table or view) being queried. Optionally, a schema name is specified. If no schema name is specified, the default schema will be used.
-
<subquery>
SELECTsubquery in aFROMexpression.
-
[ AS ] <alias_name>
Specifies the name (alias) of the object. TheASoperator may be omitted.
-
JOIN
Indicates the execution of a join between two (or more) tables (or views).
For a detailed description, seeJOINclause.
Examples
-
Select all columns from the table named
my_table:SELECT * FROM my_table; -
Select all columns from a table named
my_tablethrough the aliasmt:SELECT mt.* FROM my_table mt; -
Using the prefix alias:
SELECT mt.* FROM mt: my_table; -
Select all columns from the
my_tabletable in themy_schemaschema:SELECT * FROM my_schema.my_table; -
Select all columns from the subquery:
SELECT * FROM (SELECT * FROM my_table); -
Merge the two tables:
SELECT * FROM my_table JOIN other_table ON my_table.key = other_table.key;For a detailed description, see
JOINclause.