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

# QueryfulQL

> The query language behind every Queryful report, chart and scheduled report.

QueryfulQL is the query language behind every report in Queryful. A query asks a question of your store's data, like "what were my net sales last month" or "which products are returned most", and returns a table you can turn into a chart.

It follows ShopifyQL, the language behind Shopify's own reports, so a query written for Shopify's analytics usually runs here unchanged. You rarely need to write it yourself: the report page, Home and the AI assistant write it for you. But it's always there to read, change and share.

## Getting started

Each step adds one clause to the query before it, building from a single total to a chart.

> [accordion] What were my net sales?
>
> `FROM` picks the **sales** dataset and `SHOW` picks the **net\_sales** metric. With no date range, it covers all your history.
>
> ```sql theme={null}
> FROM sales
>   SHOW net_sales
> ```

> [accordion] Which channels did they come from?
>
> `GROUP BY` breaks the total down into a row for each sales channel.
>
> ```sql theme={null}
> FROM sales
>   SHOW net_sales
>   GROUP BY sales_channel
> ```

> [accordion] Just last month, biggest first
>
> `DURING` sets the date range, and `ORDER BY` sorts the rows.
>
> ```sql theme={null}
> FROM sales
>   SHOW net_sales, orders
>   GROUP BY sales_channel
>   DURING last_month
>   ORDER BY net_sales DESC
> ```

> [accordion] How does that compare with the month before?
>
> `COMPARE TO` runs the query again over the month before, and `WITH PERCENT_CHANGE` adds the change.
>
> ```sql theme={null}
> FROM sales
>   SHOW net_sales, orders
>   GROUP BY sales_channel
>   DURING last_month
>   COMPARE TO previous_period
>   ORDER BY net_sales DESC
>   WITH PERCENT_CHANGE
> ```

> [accordion] Show it as a chart
>
> `VISUALIZE` turns the table into a chart: here, a bar for each channel.
>
> ```sql theme={null}
> FROM sales
>   SHOW net_sales, orders
>   GROUP BY sales_channel
>   DURING last_month
>   COMPARE TO previous_period
>   ORDER BY net_sales DESC
>   WITH PERCENT_CHANGE
>   VISUALIZE net_sales TYPE horizontal_bar
> ```

See [Syntax](https://docs.queryful.app/queryfulql/syntax/overview.md) for every clause, and [Examples](https://docs.queryful.app/queryfulql/examples.md) for more complete queries.

## Where you'll meet it

The same query shows up in a few places:

| To | Use |
| - | - |
| Read or change a report's query | The [query editor](https://docs.queryful.app/user-guide/reports/query-editor.md) on any report, with suggestions and error checking as you type |
| Share a report exactly as it is | The report's link, which carries its whole query |
| Keep a report, or send it on a schedule | [Save it](https://docs.queryful.app/user-guide/reports/saving-and-exporting.md), then [schedule it](https://docs.queryful.app/user-guide/schedules/index.md) |
| Get a report without writing a query | Describe it on [Home](https://docs.queryful.app/user-guide/home.md), or ask the [AI assistant](https://docs.queryful.app/user-guide/ai-assistant.md) |

## The parts of a query

* **[Syntax](https://docs.queryful.app/queryfulql/syntax/overview.md)** is the set of clauses: `FROM` and `SHOW`, `WHERE`, `GROUP BY`, date ranges, comparisons, `TIMESERIES`, sorting, limits and charts.
* **[Datasets](https://docs.queryful.app/queryfulql/datasets/overview.md)** are the data you can ask about, from sales and orders to inventory, payouts and sessions. Each dataset's page lists its metrics, dimensions and filters.
* **[Linked records](https://docs.queryful.app/queryfulql/records/overview.md)** are the related things a dataset reaches, like the customer behind an order, and their fields.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.