> For the complete documentation index, see [llms.txt](https://docs.insuraviews.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.insuraviews.com/getting-started/additional-tools/query-builder.md).

# Query Builder

Run precise SQL queries directly against the Insuraviews database for highly customized analysis.

**What it does:** Provides direct database access for users who need specific data combinations not available through standard search and reporting tools. This access is through both a traditional SQL Editor, where users can create their own queries, or Natural Language Queries, where users can enter plain language questions, and a query will be generated for you.

**Who should use this:**

* Data analysts and actuaries comfortable with SQL
* Users needing complex data relationships
* Teams requiring specific data formats for internal systems
* Advanced users who want maximum flexibility in data extraction

#### **How to Use - SQL Editor:**

1. Access "Query Builder" and the "SQL Editor" tab
2. **Write Your Query**: Use SQL syntax to specify exactly what data you need
   * Access tables for filings, companies, states, rate changes, and more
   * Join multiple data sources for complex analysis
   * Apply custom filters and calculations
3. **Test and Validate**: Preview results before running full query
4. **Execute Query**: Run against live database
5. **Export Results**: Download your results as a CSV file

**Example Query Types:**

* **Complex Rate Analysis**: "Show me all auto rate increases >10% in California and Texas from companies with >$1B premium, including their loss ratios"
* **Temporal Patterns**: "Compare rate filing timing patterns between Q1 and Q4 over the last 3 years"
* **Regulatory Trends**: "Identify states with fastest approval times for homeowners rate increases"
* **Market Positioning**: "Calculate market share changes based on rate competitiveness by territory"

**Database Schema Access:**

* Complete documentation of available tables and fields
* Data dictionary explaining field definitions and relationships

<figure><img src="https://3627719227-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRDo7Wvsasy8Pyg5liYJv%2Fuploads%2FoMniU0F50mpkWCdw5gqd%2FQuery%20Builder%20-%20SQL%20Editor.png?alt=media&amp;token=1596c971-5f72-4455-9a36-da37792426e5" alt=""><figcaption><p>Query Builder - SQL Editor</p></figcaption></figure>

#### **How to Use - Natural Language**&#x20;

1. Access "Query Builder" and the "Natural Language" tab
2. **Write your Question**: No need for SQL syntax or technical knowledge, Natural Language allows for standard questions to be converted into SQL
3. **Generate SQL**: Converts the question to an SQL query, and then runs the query against the live database
   * Generated query is provided to the user for options to copy and edit it in the SQL Editor
4. **Export Results**: Download your results as a CSV file

**Example Questions:**

* "What is the premium-weighted rate impact for Homeowners filings in the last 12 months?"
* "Which DOI reviewers have completed the most filings?"
* "List the most common rating factors used for Personal Auto filings."

<figure><img src="https://3627719227-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRDo7Wvsasy8Pyg5liYJv%2Fuploads%2FWa6XjRhH7bSY0hDPUWHw%2FScreenshot%202026-08-05%20at%2012.13.58%E2%80%AFPM.png?alt=media&amp;token=0b42d933-e5dd-4d77-890d-9ada59da71e9" alt=""><figcaption><p>Query Builder - Natural Language</p></figcaption></figure>

#### **Safety Features:**

* Read-only access ensures data integrity
* Query timeout limits prevent system overload
* Result size limits for manageable outputs
* Query history for reproducing previous analysis


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.insuraviews.com/getting-started/additional-tools/query-builder.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
