# Writing Queries

### **The Query Panel**

When you open Configuration on a chart portlet and select Query, you’ll see the Query Panel. At the top of this panel, there are three icons representing different tabs: AI Assistant, SQL, and Results. To the right of these tabs, you’ll find the Query Builder button. The AI Assistant is selected by default.

<figure><img src="/files/b8vCzn9OEZIN585YI0ZP" alt=""><figcaption></figcaption></figure>

### **AI Assistant (Chat Bubble Icon)**

* Purpose: Allows you to type in natural language requests (e.g., “Solana price evolution from January 2023 to December 2024”).
* How It Works: After typing your request, click Send. The AI Assistant automatically converts your plain English prompt into an SQL query behind the scenes.
* When to Use: Ideal for users who aren’t comfortable writing SQL directly or prefer a quick, conversational approach to querying data.

<figure><img src="/files/6rmco3ynEzWx3ygtDouL" alt=""><figcaption></figcaption></figure>

### **SQL (SQL Icon)**

* Purpose: Lets you write or edit queries manually using SQL syntax.
* How It Works: Type or paste your SQL statement into the editor, then run the query to see the results.
* When to Use: Best for advanced users who need precise control over the query or want to add complex filters and joins.

<figure><img src="/files/ifNZGkNa3jeytlpV0Hh3" alt=""><figcaption></figcaption></figure>

### **Results (Table Icon)**

* Purpose: Displays the raw query results in a tabular format.
* How It Works: After a query runs (via AI Assistant or manual SQL), switch to this view to inspect rows and columns of returned data.
* When to Use: Perfect for verifying data correctness or exploring results before visualizing them in a chart.

<figure><img src="/files/rZOUckSgM8yJmZzh5Dhg" alt=""><figcaption></figcaption></figure>

### **Query Builder (Button)**

* Purpose: Opens a full-screen visual interface for constructing queries;
* How It Works: When clicked, the Query Builder expands to a dedicated screen where you can visually select tables, columns, and filters. This interactive environment automatically generates the corresponding SQL code based on your selections.
* When to Use: deal for users who want more control over query construction.

In addition to these items, you see other controls like Auto-Execute (toggles whether queries run automatically as you type).

💡 Tip: Each method provides a different level of flexibility, so you can choose the one that best fits your workflow.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://glint-analytics.gitbook.io/glint-analytics/querying-and-data-analysis/writing-queries.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
