Skip to main content

PROMPT_QUERY

Answer questions about your data

You can ask MotherDuck business questions about your data in plain English using the prompt_query pragma. Under the hood, MotherDuck generates, iteratively corrects, and executes SQL on your behalf, returning results of the query. Note that the prompt_query pragma is a read-only operation and does not allow queries that modify the database.

Syntax

pragma prompt_query('<natural language question>')

Example usage

We use MotherDuck's sample Hacker News dataset from MotherDuck's sample data database.

pragma prompt_query('what are the top domains being shared on hacker_news?')

Notes

MotherDuck AI operates on your current database by evaluating the schemas and contents of the database. To point MotherDuck AI at a specific database, execute the use database command (learn more about switching databases).

These capabilities are provided by MotherDuck's integration with OpenAI. For availability and pricing, see MotherDuck's Pricing Model