---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/references/dc-sql-reference/select-list.md
cuppy_section: docs
cuppy_doc: WS8S-NSSS
cuppy_doc_uuid: 930c6b5e-97fa-4fb9-8f3b-b8a4b36abcf5
cuppy_permalink: https://cuppy.io/salesforce/d/WS8S-NSSS
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-list
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: 9d45676786b3054d98ffb219c5d57e536e467c33c4a3f93b4bfd25d97a1c0fe0
# 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-list.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.

## `SELECT` List

The `SELECT` list defines expressions that form the output rows of the `SELECT` statement. The expressions can refer to columns computed in the `FROM` clause.

Every output column of a `SELECT` statement has a name. In a simple `SELECT` statement, this name labels the column for display. When the `SELECT` is a subquery of a larger query, the name is the column name of the result set produced by the subquery. To define the name of an output column, use `AS <output_name>` after the column’s expression. The `AS` keyword is optional in Data 360 SQL. You can write `<expression> <output_name>` instead. To prevent conflicts with future keyword additions, use `AS` or double-quote the output name. If you don’t specify a column name, a name is chosen automatically. If the column’s expression is a simple column reference, the chosen name is the same as the column’s name. Complex queries use the function name, type name, or a number that specifies the order of the column in the result set.

You can refer to a column name in `ORDER BY` and `GROUP BY` clauses, but not in the `WHERE` or `HAVING` clauses.

You can use `*` in the output list as a shorthand for all the columns of the selected rows. You can use `table_name.*` as a shorthand for the columns in the defined table. In these cases the output column names are the same as the table column names.

Data 360 SQL evaluates output expressions after sorting and limiting if the expressions aren’t referenced in `DISTINCT`, `ORDER BY`, or `GROUP BY`. Output expressions that contain set-returning functions are evaluated after sorting and before limiting.

The `SELECT` clause can optionally contain the `DISTINCT` keyword. `SELECT DISTINCT` removes all duplicate rows from the result set.

`SELECT DISTINCT ON ( expression [, ...] )` keeps the first row of each set of rows that match the expression. The `DISTINCT ON` expressions are interpreted using the same rules as [ORDER BY](https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/select-order.html). The first row of each set is random unless you use `ORDER BY`.

Match the `DISTINCT ON` expressions to the leftmost `ORDER BY` expressions. The `ORDER BY` clause normally contains additional expressions that determine the precedence of rows within each `DISTINCT ON` group.

This example shows a select statement selecting the `location` and `time` columns from `weather_reports` table. In addition, it also computes an additional column `"need sunscreen?"` based on the weather report.

This example shows a select statement with `DISTINCT ON` and `ORDER BY` defined. The example retrieves the most recent weather report for each location. Without `ORDER BY` the report returns a random time for each location.


---
<!-- 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 -->
