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

# Superset hands-on examples

> Examples showing how to run queries and build dashboards in Superset.

The Superset hands-on examples page demonstrates how to use Superset.
It includes two examples, running a query and creating charts and dashboards.

## Run a query

Generally, when using SQL Lab to run a query, you take the following steps:

1. Select a catalog, schema, and table.
2. Enter a query and run it. Superset displays all available tables.

Assume you entered a query that does the following:

* Selects unique employee IDs and first names
* Orders the results by employee ID in ascending order
* Limits the results to 50 rows

```sql theme={null}
SELECT DISTINCT employee_id, first_name
FROM employees1
ORDER BY employee_id ASC
LIMIT 50
```

There are some important things to know when trying to understand your result.

* On Superset, this query would generate a table preview.

  <Card img="https://mintcdn.com/nexusone-4c77570d/Go9bGnZeL5EGSoDm/images/platform-components/apache-superset/03-query-preview.png?fit=max&auto=format&n=Go9bGnZeL5EGSoDm&q=85&s=43fb95a9ebfb848c6291eba0d56804aa" width="2864" height="1726" data-path="images/platform-components/apache-superset/03-query-preview.png">
    SQL Lab query example
  </Card>

* If you'd rather create a table or view, you can click the dropdown menu beside
  **Run**. It provides an option to create a table or view.

  <Card img="https://mintcdn.com/nexusone-4c77570d/Go9bGnZeL5EGSoDm/images/platform-components/apache-superset/04-create-a-table-or-view.png?fit=max&auto=format&n=Go9bGnZeL5EGSoDm&q=85&s=036bdf9b4e4175e08793debaeb7c6df1" width="972" height="594" data-path="images/platform-components/apache-superset/04-create-a-table-or-view.png">
    Create a table or view
  </Card>

* After running the query, the results appear in a table format.

  <Card img="https://mintcdn.com/nexusone-4c77570d/Go9bGnZeL5EGSoDm/images/platform-components/apache-superset/05-query-result.png?fit=max&auto=format&n=Go9bGnZeL5EGSoDm&q=85&s=c5b775389bc0b0c0884ca04f572a7f1e" width="2066" height="1068" data-path="images/platform-components/apache-superset/05-query-result.png">
    Query result
  </Card>

* You can also view a history of when you ran these queries.

  <Card img="https://mintcdn.com/nexusone-4c77570d/Go9bGnZeL5EGSoDm/images/platform-components/apache-superset/06-query-history.png?fit=max&auto=format&n=Go9bGnZeL5EGSoDm&q=85&s=16e8a82aac7f62f0fd0efcf2e682db84" width="2066" height="1068" data-path="images/platform-components/apache-superset/06-query-history.png">
    Query history
  </Card>

## Create a dashboard

You can create charts and dashboards in Superset to explore and visualize your data.

Follow these steps to create a line chart and dashboard:

1. From the Superset navigation bar, click **Charts** and select **+ Chart**
   to create a new chart.
2. Choose the dataset you want to visualize.
3. Choose a chart type, for example, `Line Chart`, and click **Create New Chart**.
4. Configure the chart:
   * Set the X-axis.
   * Set the Metrics.
   * Optional: Add filters or groupings as needed.
5. Click **Create Chart** to preview the chart.
6. Click **Save**, enter a chart name, select or create a dashboard, and
   click **Save & Go to Dashboard**.

The following images show what the chart creation process looks like and
the outcome of adding the chart to a dashboard.

<Card img="https://mintcdn.com/nexusone-4c77570d/Go9bGnZeL5EGSoDm/images/platform-components/apache-superset/07-creating-a-chart.png?fit=max&auto=format&n=Go9bGnZeL5EGSoDm&q=85&s=3f990dc0744eb12417561c36e80cecd8" width="1898" height="953" data-path="images/platform-components/apache-superset/07-creating-a-chart.png">
  Creating a chart in Superset
</Card>

<Card img="https://mintcdn.com/nexusone-4c77570d/Go9bGnZeL5EGSoDm/images/platform-components/apache-superset/08-created-dashboard.png?fit=max&auto=format&n=Go9bGnZeL5EGSoDm&q=85&s=7dc8316249ae0c1a476b3ee71c64bfd6" width="2870" height="1728" data-path="images/platform-components/apache-superset/08-created-dashboard.png">
  Dashboard created from the chart
</Card>

## Additional resources

* To get an overview of Superset, refer to the [Superset in NexusOne](./superset-in-nx1) page.
* For more details about Superset, refer to the [Superset](https://superset.apache.org/docs/intro)
  official documentation.
* To learn more about how NexusOne uses KeyCloak and Trino, refer to the
  [NexusOne KeyCloak](../keycloak) and [Trino](../trino) documentation.
