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

# NQL Syntax

> Overview of NQL statement types and general grammar

NQL (Narrative Query Language) uses SQL-like syntax with extensions for data collaboration. This page provides a high-level overview of statement types and links to detailed references.

## Statement types

NQL supports two main statement types:

| Statement                  | Purpose                              | Reference                                                          |
| -------------------------- | ------------------------------------ | ------------------------------------------------------------------ |
| `SELECT`                   | Execute a query and return results   | [SELECT](/nql/commands/select)                                     |
| `CREATE MATERIALIZED VIEW` | Create a stored dataset from a query | [CREATE MATERIALIZED VIEW](/nql/commands/create-materialized-view) |

## Query Templates

NQL also supports parameterized queries through [query templates](/nql/commands/query-templates), which use placeholder syntax to create reusable, customizable queries.

## Key syntax rules

* **Explicit columns required**: NQL does not support `SELECT *` or `COUNT(*)`. See [Explicit Column Selection](/nql/general/explicit-columns).
* **Reserved keywords**: Certain keywords must be quoted when used as identifiers. See [Reserved Keywords](/nql/general/reserved-keywords).
* **Fully qualified names**: Use fully qualified column names (e.g., `company_data."123".column_name` or `company_data.my_dataset.column_name`) to avoid ambiguity, especially in joins.
* **Dataset references**: Reference a dataset in the `company_data` schema by its numeric ID (`company_data."123"`) or its name (`company_data.my_dataset`). Numeric IDs must be quoted because they're numeric; names need quoting only when they're a reserved keyword or contain special characters. See [NQL vs. SQL](/concepts/nql/sql-comparison) for when each form is used and why.

## Related content

<CardGroup cols={2}>
  <Card title="SELECT" icon="magnifying-glass" href="/nql/commands/select">
    Full SELECT statement syntax and clauses
  </Card>

  <Card title="Data Types" icon="shapes" href="/nql/data-types">
    Primitive and complex types supported in NQL
  </Card>

  <Card title="Operators" icon="calculator" href="/nql/operators">
    Comparison, logical, and arithmetic operators
  </Card>

  <Card title="Functions" icon="function" href="/nql/functions/index">
    Built-in and Narrative-specific functions
  </Card>

  <Card title="NQL vs. SQL" icon="right-left" href="/concepts/nql/sql-comparison">
    How NQL differs from standard SQL, including dataset references
  </Card>
</CardGroup>
