> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.omni.co/feedback

```json
{
  "path": "/modeling/query-views/parameters/sql",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# sql

> Defines the SQL query used by the query view.

If the query view was created using SQL, this parameter will be automatically populated with the SQL query from the workbook. Otherwise, this parameter will be omitted.

## Syntax

```yaml title="Single line" theme={null}
sql: <sql_statement>
```

```yaml title="Multi-line" theme={null}
sql: |
  <sql_statement>
```

## Properties

<ParamField path="sql" type="string">
  The SQL statement that the query view is based on. If the query view was created using SQL, this parameter will be automatically populated with the SQL query from the workbook.
</ParamField>

## Examples

```yaml title="sql_query_view.query.view" highlight={2-5} theme={null}
schema: PUBLIC
sql: |
  SELECT user_id, sum(sale_price) as total_sales
  FROM order_items
  GROUP BY 1
dimensions:
  user_id: {}
  total_sales: {}
  measures:
    count:
      aggregate_type: count
```
