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

# Datasets overview

> Write SQL queries against your datasources and publish the results.

A **dataset** is a saved SQL query tied to a specific [datasource](/datasources/overview). Datasets are the foundation of everything you visualize in Mora, every chart on a dashboard gets its data from a dataset.

## Creating a dataset

1. Navigate to **Datasets** in the sidebar.
2. Click **New dataset**.
3. Select the datasource you want to query.
4. Write your SQL in the [editor](/datasets/sql-editor).
5. Press **Cmd+Enter** to preview results.
6. Press **Cmd+S** to save and publish.

## Dataset lifecycle

Datasets go through two stages:

1. **Draft**: the query you are actively editing, by hand or via the AI. Unsaved changes show as a diff against the published query. See [Draft and publish](/datasets/draft-suggest-publish).
2. **Published**: the saved query. Publishing runs the query against your database and materializes the results so charts can display them.

## What happens when you publish

When you save a dataset, Mora runs the query in the background and stores the results. This means:

* Charts load instantly from the materialized data, not from a live query every time.
* You can apply [transformations](/datasets/transform) (group, aggregate, filter, sort) without hitting your database again.
* Published results are updated each time you save.

## Related

* [SQL editor](/datasets/sql-editor), writing and running queries.
* [Transformations](/datasets/transform), transform results without more SQL.
* [Privacy](/datasets/privacy), private vs. shared datasets.
* [Managing datasets](/datasets/manage), rename, delete, duplicate.
