> For the complete documentation index, see [llms.txt](https://glint-analytics.gitbook.io/glint-analytics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://glint-analytics.gitbook.io/glint-analytics/querying-and-data-analysis/writing-queries.md).

# 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.
