SQL query from a question
A plain-language question becomes an SQL query, with an explanation so you understand what it does.
- Type
- Prompt
- Level
- Beginner
- Time
- about 4 min
Results depend on the tool, the model and what you enter.
Fill in
What you type stays in this browser window. We store and send nothing.
- PostgreSQL
- MySQL
- SQLite
- SQL Server
- BigQuery
- Which ten products sold most last month?
- How many new customers did we get each week?
- Which customers have not ordered for a year?
- What is the average order value by country?
- Which items are out of stock right now?
- orders(id, customer_id, created_at, total), customers(id, country, created_at)
- products(id, name, stock), order_items(order_id, product_id, quantity)
- customers(id, name, last_order_at)
- orders(id, country, total, created_at)
- products(id, name, stock, category)
Your prompt
Write an SQL query for [Database]. Question: [Question]. Tables and columns: [Schema] Explain the query line by line in simple words. Read-only queries (SELECT) only, no changes to data. Point out possible traps such as duplicate rows or missing values.
Matching tools
Tools from our catalog that this prompt works well with.
- ChatGPT Prices and limits
- Claude Prices and limits
- Gemini Prices and limits
How to use it
- Fill in the fields or tap a suggestion. Leave out names, addresses and other personal data.
- Copy the finished prompt into a tool of your choice.
- Run the query on a copy or with LIMIT first and check a few rows by hand.
Works in these tools
Prompts work in many chat and generator tools. This selection comes from our catalog; prices as shown on the tool page.
- ChatGPT Free planfrom 8 USD per month
- Claude Free plan
- Gemini Free plan
- GitHub Copilot Free planfrom $10
Why does this work?
The schema prevents invented column names. Limiting it to SELECT makes the query safe for beginners.
Tips
- Never put real customer data into the prompt, only table and column names.