# Explore Examples

Source: https://userguide.qualytics.io/explore/deep-dive/examples/

Questions people bring to Explore, and how a workspace answers them. Each scenario starts from a goal and ends with the reason the approach holds up.

> **Info: Before you start**
>
> These scenarios assume the two ways a query can run, covered in [SQL Modes](https://userguide.qualytics.io/explore/deep-dive/sql-modes/), and the way results load and expire, covered in [Results](https://userguide.qualytics.io/explore/deep-dive/results/). Running SQL needs the **Author** or **Editor** team permission on every datastore the query reads. See [Explore Permissions](https://userguide.qualytics.io/explore/deep-dive/permissions/).

## Checking an anomaly against the source rows

**Context.** A Scan flagged negative amounts in the `orders` table. A data steward wants to see the rows behind it as they are in the database today, not as a sample captured at scan time.

**What happens.** The steward opens the datastore's **Explore** tab, starts a workspace, and writes a query that selects the suspect rows with the fields that help explain them:

```sql
SELECT id, amount, status, updated_at
FROM orders
WHERE amount < 0
ORDER BY updated_at DESC
```

After the run, the header of each column that shows a field as it is carries a count of that field's active anomalies. Clicking the badge on `amount` opens the field's profile in a side panel. From there, the  button on the **Active Anomalies** card opens the field's anomalies in a side panel of their own, next to the rows.

**Why it works.** The query reads the source directly, in its own SQL, so the rows are current. Columns selected unchanged keep their link to the field they come from, which is what puts the anomaly count beside the values. An expression or an aggregate has no such link, so it carries no count. Select the field as it is when you want to see its anomalies.

## Joining two schemas on one connection

**Context.** Orders live in a datastore on the `sales` schema and customer segments in another datastore on the `crm` schema. Both datastores use the same connection. An analyst wants revenue by segment.

**What happens.** In a workspace on the `sales` datastore, the analyst opens the **+N** menu next to the datastore button, which lists the other datastores that share the connection, and clicks `crm` to insert its prefix. The query names the other table behind that prefix:

```sql
SELECT c.segment, SUM(o.total) AS revenue
FROM orders o
JOIN crm.customers c ON c.id = o.customer_id
GROUP BY c.segment
ORDER BY revenue DESC
```

After the run, **Read from** in the results bar lists both datastores.

**Why it works.** In the datastore's own SQL, a table named alone is read from the workspace's datastore, and a prefixed table is read from the datastore that stands for that schema (or database and schema, on engines that read across databases). The run is checked against every datastore the query reads, so the analyst needs **Author** or **Editor** on both. A query reads the datastores of one connection only; joining across connections is not possible.

## Reading files with Spark SQL

**Context.** A file datastore receives a CSV drop every day. An engineer wants to count events per day across all the drops.

**What happens.** A workspace on a file datastore runs in Qualytics mode, with Spark SQL, and the mode cannot be switched. The engineer names the container that groups the files. A name that holds characters such as `/`, `.` or `*` goes in backticks:

```sql
SELECT event_date, COUNT(*) AS events
FROM `events_*.csv`
GROUP BY event_date
ORDER BY event_date
```

**Why it works.** Spark SQL reads the datastore's containers by name, as Qualytics sees them, including computed files. A query can read up to 10 containers, and each one is read whole before the query runs, so naming only the containers you need keeps the run short. Because this query reads a single container, **Save as computed file** can keep it as a computed file, so the daily counts can be profiled and scanned like any other container.

## Trying an expression before saving a computed field

**Context.** A data engineer wants a `total_usd` field on `orders` and is not sure the conversion handles missing rates.

**What happens.** On the container's **Explore** tab, the engineer clicks **Add Field** , names the custom column `total_usd`, writes the expression `total * fx_rate`, and runs the workspace. Scrolling the results shows nulls wherever `fx_rate` is missing, so the expression becomes `total * COALESCE(fx_rate, 1)`. Once the values look right, **Save as Computed Field** opens the computed field form with the expression filled in. After the field is saved, the custom column is removed and the workspace runs again, showing the computed field in its place.

**Why it works.** A custom column is a Spark SQL expression over each row, like the custom expression of a computed field, so what you see in the results is what the field will hold. Testing against real rows catches nulls and type surprises before profiles and checks depend on the field. Custom columns need **Author** or **Editor** on the datastore, and saving needs a container that has been profiled. See [Add a Custom Column](https://userguide.qualytics.io/explore/how-tos/container-tab/add-a-custom-column/) and [Save a Custom Column as a Computed Field](https://userguide.qualytics.io/explore/how-tos/container-tab/save-as-computed-field/).

## Asking the assistant to fix a failed query

**Context.** A query fails with an error about a column that does not exist. The analyst is not sure which table renamed it.

**What happens.** The error card shows the message and offers **Fix with AgentQ** . Clicking it sends the failure to the **Explore Assistant** docked beside the workspace, which answers with a proposed query in a card. **Apply** puts the SQL in the editor and highlights what changed, without running it. **Apply & run** also runs it. A card the assistant replaces with a later one shows **Outdated**.

**Why it works.** The assistant reads the workspace's SQL, the datastore's tables and their fields, and the failure, so it corrects the query in context. It only proposes: nothing runs until you apply it, and the run goes through the same checks as one you write yourself. How much of the failure it sees follows the AgentQ data sharing level; below **Source data shared**, the error detail is left out. See [Fix a Failed Query](https://userguide.qualytics.io/explore/how-tos/explore-assistant/fix-a-failed-query/).

## Charting a breakdown

**Context.** An operations lead wants a picture of open orders by region for a status meeting.

**What happens.** The lead aggregates in SQL so the result is small:

```sql
SELECT region, COUNT(*) AS open_orders
FROM orders
WHERE status = 'open'
GROUP BY region
ORDER BY open_orders DESC
```

On the **Chart** tab of the results, the lead picks **Bar**, `region` for the **X axis**, and `open_orders` for the **Y axis**. The query already returns one row per region, so the panel says `One row per region, shown as it is` instead of offering ways to combine rows. The lead sorts by `open_orders, high to low`. The download button saves the chart as a PNG, or a PDF report that also carries the values and the query.

**Why it works.** A chart draws the rows loaded so far. Aggregating in SQL returns one row per region, so every row is loaded and the chart reflects the whole answer rather than the first page. A bar chart with more than 20 values keeps the top 19 and folds the rest into **Other**, which a grouped query with a sensible number of categories avoids. See [Charts](https://userguide.qualytics.io/explore/deep-dive/charts/).

## An Admin reviewing failed runs

**Context.** Several people report that their Explore queries on one datastore stopped working after a schema change. An Admin wants to see what failed and why.

**What happens.** The Admin opens **History**  from the Explore sidebar, sets the dates to cover the change, filters **Datastore** to the one affected and **Outcome** to **Failed**. The summary tiles show how many runs failed and how many people they affected. Expanding a run shows its SQL and its error, which point to the renamed column.

**Why it works.** Every SQL run opened in Explore is recorded with who ran it, the datastore it ran through, the outcome, and the error, and runs are kept for 90 days. Only Admins see the History page and other users' runs. Their access is read-only: an Admin reads the SQL that ran, but cannot open another user's workspaces or results. Queries refused by the checks before they run, and reads on a container's **Explore** tab, are not recorded. See [History](https://userguide.qualytics.io/explore/deep-dive/history/).

---

## See Also

- **Best Practices**

  Habits that keep queries fast, results trustworthy, and masked data protected.

  [Best Practices](https://userguide.qualytics.io/explore/deep-dive/best-practices/)
- **Permissions**

  The user roles and team permissions behind running SQL, revealing masked values, and reviewing history.

  [Permissions](https://userguide.qualytics.io/explore/deep-dive/permissions/)
- **How Explore Works**

  What a run is, how rows load as you scroll, how a run ends, and the limits that apply to every result.

  [How Explore Works](https://userguide.qualytics.io/explore/deep-dive/how-it-works/)
- **Workspaces**

  The saved, private places that hold each query, its datastore, and its last result.

  [Workspaces](https://userguide.qualytics.io/explore/deep-dive/workspaces/)
- **SQL Modes**

  Running a query on the datastore in its own SQL, or in Qualytics with Spark SQL, and what each mode can read.

  [SQL Modes](https://userguide.qualytics.io/explore/deep-dive/sql-modes/)
- **Query Editor**

  The editor's controls: the datastore, the SQL badge, autocomplete, running a statement or a selection, formatting, and saving a computed table or file.

  [Query Editor](https://userguide.qualytics.io/explore/deep-dive/query-editor/)
- **Results**

  The results grid, row counts, query details, cell values, masked values, and downloads.

  [Results](https://userguide.qualytics.io/explore/deep-dive/results/)
- **Charts**

  Bar, line, and scatter charts of the rows loaded so far, charts proposed by AgentQ, and their PNG and PDF downloads.

  [Charts](https://userguide.qualytics.io/explore/deep-dive/charts/)
- **History**

  The runs of each workspace, and the History page where Admins review every query run.

  [History](https://userguide.qualytics.io/explore/deep-dive/history/)
- **Assets**

  The datastores, tables, and fields you can drag into your SQL, and why some of them stay locked.

  [Assets](https://userguide.qualytics.io/explore/deep-dive/assets/)
- **Explore Assistant**

  The AgentQ chat beside each workspace that proposes queries and charts, and helps fix failed queries.

  [Explore Assistant](https://userguide.qualytics.io/explore/deep-dive/explore-assistant/)
- **Datastore and Container Tabs**

  The Explore tab of a datastore, and the Explore tab of a table or file with its fields, filter, and custom columns.

  [Datastore and Container Tabs](https://userguide.qualytics.io/explore/deep-dive/datastore-and-container-tabs/)

*Last updated: November 24, 2026.*
