# Viewing, querying, and editing the data

Fabricate provides multiple views for a Data Agent database. You can also run queries against the data and make direct updates to values in data cells.

## Available views of a Data Agent database

For a Data Agent database, you can choose from the following types of views:

* **Table view -** The default view. Displays the data for the current table in a table.
* **JSON view -** Displays the data for the current table as a set of JSON documents. Each row is a separate document.
* **Findings view -** Provides an analysis of the table structure and data. Findings view is populated when the Data Agent [profiles the database](https://docs.tonic.ai/fabricate/data-agent-databases/data-agent-profile).

Table view is the default.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2FAMScROrbbLY3N9jrZJ1H%2FDataAgent_TableViewIcon.png?alt=media&#x26;token=48d70b85-3f5a-43b8-b69d-6b68d47eba1b" alt=""><figcaption><p>Table view icon </p></figcaption></figure>

To switch to JSON view, click the JSON view icon.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2FU6TRuAoNNbQuU48or7j1%2FDataAgent_JSONView.png?alt=media&#x26;token=a5b7a70c-79dd-4306-a01b-b088a52c2f1b" alt=""><figcaption><p>JSON view for a Data Agent database</p></figcaption></figure>

To switch to Findings view, click the magnifying glass icon.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2F6N9YGWoJFoFDTr6lQoOK%2FDataAgent_FindingsView.png?alt=media&#x26;token=d202a9bb-ba0e-4577-b3c7-302fed000f07" alt=""><figcaption><p>Findings view for a Data Agent database</p></figcaption></figure>

## Asking the Data Agent about the data

In addition to using the Data Agent to create and make changes to the data, you can also request information about the data.

For example, you might ask something like:

* &#x20;`How many customers have more than 2 items in an order?`
* `How many customers are from each state?`

If applicable, the Data Agent generates a pie chart or bar chart to illustrate the results. You can also prompt the Data Agent to generate a specific type of chart.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2F1NcnLFCkFZLfbkk2vpMG%2FDataAgent_DataGraph.png?alt=media&#x26;token=32af499e-ac5f-4138-8c1f-4630fea1365e" alt=""><figcaption></figcaption></figure>

## Running SQL queries against the data

You can run SQL queries against a Data Agent database to:

* Retrieve information about the data
* Retrieve a subset of the data
* Add records to the data
* Update records in the data
* Remove records from the data

To run a SQL query against the database:

1. Click **SQL**.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2FYCJrsNqkyYXnfsXonp7h%2FDataAgent_SQLOption.png?alt=media&#x26;token=c5548be0-0207-4f5a-9830-f5a8571b102c" alt=""><figcaption><p>SQL option to run a SQL query against the data</p></figcaption></figure>

2. On the **SQL Editor** panel, in the SQL field, provide the SQL query.\
   \
   The SQL can include `SELECT`, `INSERT`, `UPDATE`, and `DELETE`.
3. Click **Execute Query**.

## Editing individual cells

In a Data Agent database, to get the exact value that you want, you can manually edit the values in individual cells.

You cannot edit individual cells in a live connection database.

To edit an individual cell value:

1. Click the cell value.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2FdbSwNX2I334HsKvRRPNd%2FDataAgent_ManualEditOption.png?alt=media&#x26;token=17669839-594a-431a-b37a-d9e7f9c2acaa" alt=""><figcaption><p>Clicking a cell value to manually edit it</p></figcaption></figure>

2. On the edit panel, enter the new value.

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2Fu24TPiJftCcrRCCKIHqw%2FDataAgent_ManualEditPanel.png?alt=media&#x26;token=51d1962f-6d24-4e9f-a290-5090051979c9" alt=""><figcaption><p>Edit Cell Value panel to edit the value in a cell</p></figcaption></figure>

3. Click **Save**.
