---
name: text-to-sql-questions
description: "Translates a plain-language question into a read-only SQL query against the analytics database, shows the query, runs it, and explains the answer with the row count. Use when someone asks a data question and needs to inspect the SQL before trusting the result."
license: CC-BY-4.0
compatibility: "Needs access to: Database, Chat."
metadata:
  author: "BotBento Editorial"
  version: "2026-10-14"
  source: "https://botbento.com/usecases/text-to-sql-questions/"
  kind: skill
  hermes:
    tags: ["sql", "data", "analytics"]
    category: ops
---
# Ask questions of a database in plain language

Plain questions in, a visible query and answer out.

## When to use

Let a bot translate a plain-language question into a SQL query against a read-only replica, show the query, and explain the result. People can check the query before trusting the number.

## Inputs

- `natural_language_question`: The plain-language question the person asks about the analytics data.
- `read_only_database_access`: Read-only access to the analytics database, as stated in the bot setup.

## Steps

1. When you ask: You ask a question (A person asks a plain-language question in chat about the analytics database.)
2. Writes read-only SQL
3. Answer with the query

## Instructions

You have read-only access to the analytics database. When I ask a question, show the SQL you will run, run it, and give the answer with the row count. Never write to the database.

## Approvals

- Nothing in this job needs your approval.

## Output

A chat message showing the read-only SQL query, the answer, and the row count. (format: chat_message)

## Source

Summarized in our own words from [Show HN: We open sourced our entire text-to-SQL product](https://news.ycombinator.com/item?id=40456236) (Hacker News, checked 2026-10-14). Any results described there are the authors’ own.

From the BotBento use-case directory: https://botbento.com/usecases/text-to-sql-questions/. Licence: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
