The SQL FROM clause is the backbone of any data-retrieval query. It tells the database which table, view, or derived table (subquery or common table expression) is the initial source of rows. The query planner builds the rest of the execution plan around this clause, applying joins, filters, grouping, and projections only after determining where the data comes from.A single query can list multiple table references in the FROM clause, either separated by commas (legacy syntax) or connected with explicit JOIN operators. Modern best practice favors explicit JOINs because they make join conditions, join order, and join types clear. The FROM clause accepts:- Base tables and views- Aliased tables for shorter or clearer column references- Inline subqueries wrapped in parentheses and optionally aliased- Common table expressions (via WITH) that act like temporary views- Table functions or set-returning functions, depending on dialectExecution order is logical, not physical: the FROM clause is processed before WHERE, GROUP BY, HAVING, or SELECT projections. Misunderstanding this order can lead to unexpected results or performance issues. Caveats:1. Omitting required join predicates can create a Cartesian product.2. Comma-separated tables implicitly create CROSS JOINs that may harm performance.3. Some dialects (SQLite) require parentheses around joined subqueries.4. ANSI SQL forbids columns in SELECT that are not aggregated or grouped unless they originate from the GROUP BY source, but many databases relax this rule.5. Read privileges on the referenced objects are mandatory; otherwise, the query fails with a permission error.
- table_reference
(identifier | subquery) - Base table, view, or derived table to read from- alias
(identifier, optional) - Alternate name for the table reference- join_condition
(boolean expression, optional) - Predicate that defines how rows from two sources are matchedSELECT, WHERE, JOIN, INNER JOIN, LEFT JOIN, CROSS JOIN, WITH (CTE), GROUP BY
SQL-86 (ANSI SQL-1)
It defines the source tables, views, or subqueries that the query will read data from.
Absolutely. Use explicit JOIN syntax to connect them and specify the join condition.
Aliases are optional but strongly recommended when the query involves more than one table or a subquery to avoid ambiguity.
The database creates a Cartesian product between the tables, which usually returns far more rows than expected and hurts performance.