---
title: Analyze with AI agents
description: How to ask an AI for numbers from Queria data, and tips on asking well
---

Once an AI chat or AI agent is connected to Queria, you can ask it what you want to know in everyday words. The AI finds the tables, writes SQL and returns the result. This page walks through the flow using "which municipalities are growing in population?" as an example.

Before you start, connect your AI to Queria.

- Claude, ChatGPT or Microsoft 365 Copilot: [Use it from an AI chat](/en/ai-chat)
- Claude Code, Codex and similar: they work once the [Queria CLI](/en/cli) runs. If you use it often, install the [Queria skill](/en/queria-skill) with `uvx queria skills install` so you do not have to explain the CLI to the AI each time

## Ask whether the data exists

If you do not know which table to use, ask the AI.

> Does Queria have population data?

The AI searches Queria's datasets and answers with candidate tables and columns.

> The e_stat dataset has a table `a_municipal_population` (population and households by municipality), with columns such as area, area_name, year, item_name and value.

## Ask for the numbers

Once the table is settled, ask what you want to know.

> Show me the top 20 municipalities by population growth

The AI writes and runs SQL that compares the population in two years, and returns the result as a table.

| area_name      | pop_2015 | pop_2020 | growth_rate_pct |
| -------------- | -------- | -------- | --------------- |
| 東京都 中央区   | 141,183  | 169,179  | 19.83           |
| 千葉県 流山市   | 174,373  | 199,849  | 14.61           |
| 大阪府 大阪市 西区 | 92,430 | 105,862  | 14.53           |
| ...            | ...      | ...      | ...             |

You can see the SQL the AI wrote in the conversation. If you doubt how a number was produced, check the conditions in the SQL.

## Keep asking

The AI remembers the previous result, so you can continue.

> Also look at net in-migration for the top municipalities

> Compare their age structure too. I want to know whether they have more young people or more older people

The AI finds the tables for migration and population by age, and aggregates them next to the earlier result.

## Ask how to read the result

> What does this data tell us?

The AI writes what the results suggest, for example: "the top of the list has central wards under redevelopment and suburbs of big cities, and the main reason for growth appears to be families with children moving in". This is the AI's guess, so check the data behind it before using it in a report.

## Tips for asking

- Ask a question whose answer you can picture. "Which municipalities are growing?" lets the AI decide how to aggregate more easily than "analyze the data"
- Do not ask everything at once. Look at a result, then ask the next question
- Say how to compare: "by year", "by region", "by sex"
- If you have a hypothesis, state it. Writing "Isn't it the suburbs that are growing?" makes the AI aggregate to check it

## Read next

- [Reports](/en/reports): save the result as a report with tables and charts
- [Showcase](https://queria.io/showcase): read reports others have published
