> 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="https://544419862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA6yhE6HfjtfdPqgvKNnu%2Fuploads%2FHHJKaDvW3e3K3Rs0iKmM%2FGlint%20QSG%2031.png?alt=media&amp;token=16c3d38c-21b5-4ede-aecd-4f7ce8807893" 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="https://544419862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA6yhE6HfjtfdPqgvKNnu%2Fuploads%2FEvBE0EtfKCHxOO7GruXH%2Fglint_place_holder.png?alt=media&amp;token=89f0bc8c-1a6f-4310-875f-994c3c89d66f" 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="https://544419862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA6yhE6HfjtfdPqgvKNnu%2Fuploads%2FiaU7CLJ7R5y1RZEPgOwz%2Fglint_place_holder.png?alt=media&amp;token=a6f32640-6cba-4629-a631-ae6b29d1ae51" 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="https://544419862-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA6yhE6HfjtfdPqgvKNnu%2Fuploads%2Fxmc5pZset7hTcSL2oAuj%2Fglint_place_holder.png?alt=media&amp;token=30c2ed53-0551-4373-829e-f6563152a6a8" 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.
