---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/select-from.md
cuppy_section: docs
cuppy_doc: 4RKN-JZQ9
cuppy_doc_uuid: 71c5273e-976f-4452-ab34-af82bc5fc8d0
cuppy_permalink: https://cuppy.io/salesforce/d/4RKN-JZQ9
cuppy_version: 1
cuppy_updated: 2026-10-23T16:16:52.575Z
cuppy_canonical: https://cuppy.io/salesforce/docs/reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/select-from
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: d6092239fe51c2ecf6cece88ee910e8dfdd48a17a57cac6e91b3b260e6cb37c5
# cuppy_body_sha256 is over the document body ALONE, excluding both generated blocks.
---

> Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/select-from.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

## `FROM` Clause

The `FROM` clause defines one or more source tables as the data source. If multiple sources are specified, the result is the join of the sources. Use the `FROM` clause with the `WHERE` clause to reduce the number of returned values in the join.

The `FROM` clause can contain these elements.

`<table_name>`
The name of an existing table or view.

`<alias>`
A substitute name for the `FROM` item. When you provide an alias, the alias replaces the name for the `SELECT` command. For example, `FROM foo AS f`, the rest of the `SELECT` to `f` not `foo`. The `AS` keyword is optional in Data 360 SQL. You can write `FROM foo f` instead. If you provide an alias, you can also create a column alias list for one or more columns of the table.

`<select>`
The `<select>` is a subquery of the main `SELECT` command. Surround the subquery in parentheses. If you don’t provide an alias, the columns of the subquery are only accessible if their names are unique. You can use [VALUES](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/values.html) as subquery.

`<with_query_name>`
You can reference a `WITH` query by its name. You can also provide an alias in the same way.

`<function_name>`
Function calls can appear in the `FROM` clause. The function’s output is created as a temporary table for the duration of the `SELECT` command. You can provide a function alias and column alias list for one or more attributes of the function’s composite return type.

`LATERAL`
The `LATERAL` keyword can precede a subquery or a function call `FROM` item. In Data 360 SQL, subqueries can always access the attributes of preceding `FROM` items, even if the `LATERAL` keyword isn't specified.

**Joins**

A `JOIN` clause combines two `FROM` items. Use parentheses to determine the order of nesting. In the absence of parentheses, `JOIN` nests left to right. `JOIN` binds more tightly than the commas separating `FROM`-list items. For examples of joins, see [Join Records from Different Data Model Objects (DMOs) and Data Lake Objects (DLOs)](https://developer.salesforce.com/docs/data/data-cloud-query-guide/guide/query-joins.html).

For the `INNER` and `OUTER` join types, specify the `NATURAL`, `ON join_condition`, or `USING (join_column [, ...])` joins conditions.

`<join_type>`
`CROSS JOIN` and `INNER JOIN` return all of the results of the provided items.

`LEFT OUTER JOIN` returns all combined rows that pass its join condition and each row in the left-hand table. This join inserts null values in the left-hand row for the right-hand unmatched columns. The `JOIN` clause’s condition is considered to match rows. Outer conditions are applied after the join.

`RIGHT OUTER JOIN` returns all combined rows that pass its join condition and each row in the right-hand table. This join inserts null values in the right-hand row for the left-hand unmatched columns.

`FULL OUTER JOIN` returns all the joined rows, the unmatched left-hand rows (extended with nulls on the right), and the unmatched right-hand rows (extended with nulls on the left).

`ON <join_condition>`
`ON <join_condition>` is an expression that results in a `boolean` that specifies the rows in a join that match.

`USING ( <join_column> [, ...] )`
One of each pair of equivalent columns is included in the join output.

`NATURAL`
`NATURAL` is a `USING` list with all columns in the two tables that have matching names. If there are no common column names, `NATURAL` returns all items.

`from_item` can be one of:

This example shows how to obtain the union of the tables `distributors` and `actors`, limiting the results to those that begin with the letter W in each table.

Distributors:

Actors:

Results:

This example shows how to use a function in the `FROM` clause. Data 360 SQL doesn’t support user-defined table functions, but some built-in [set-returning functions](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/set-returning-functions.html) are supported, including [`result_scan`](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/result-scan.html) for querying the results of a previously executed query.

Results:


---
<!-- cuppy -->
You are reading one file. The same content is free over MCP at https://cuppy.io/mcp with no signup: ranked search across all 376 documents in this hub, the merged view when you work in a layer, known workarounds matched to the error you hit, and depth control so you spend tokens on what you need. Start with the `_hello` tool. How to connect: https://cuppy.io/salesforce/ Something wrong in this document? Report it with the `session feedback` tool on the same endpoint.
<!-- /cuppy -->
