From a plain-English question to ready-to-run SQL
Ask a question in plain English — the AI finds the right database, writes the SQL, runs it read-only, and hands you back both the answer and the query. You don't even need to remember your own schema.
- Model: Claude Haiku 4.5 — the cheapest, fastest Claude.
- Sample: sakila — the MySQL DVD-rental demo (films, customers, rentals, payments).
Not Opus. Not the top-tier Fable 5 (the Mythos-class model above Opus). Every join below ran on the budget model — that's the point.
Round 1 — ask in plain English
You: I have a database about movie rentals somewhere in my MySQL connections — I don't remember which one. Find it and show me the top 5 films by total revenue.
You named nothing — no connection, no database, no table. The AI finds it by chaining read-only tools:
list_connections → several MySQL connections
list_databases → spots sakila
list_tables → film, inventory, rental, payment
Then it writes the four-table join, runs it read-only (30 ms), and answers:
AI: Top 5 films by revenue in
sakila:
Film Revenue Rentals TELEGRAPH VOYAGE $231.73 27 WIFE TURN $223.69 31 ZORRO ARK $214.69 31 GOODFELLAS SALUTE $209.69 31 SATURDAY LAMBS $204.72 28
Another question, different tables, same flow:
You: And who's my single biggest-spending customer?
AI: KARL SEAL — $221.55 across 45 payments (runner-up: Eleanor Hunt, $216.54). Joined
customer → payment.
Round 2 — keep the queries
You: Give me those queries so I can run them myself in the SQL Console.
AI: Top films by revenue:
SELECT f.title, ROUND(SUM(p.amount), 2) AS revenue, COUNT(DISTINCT r.rental_id) AS rentals FROM film f JOIN inventory i ON i.film_id = f.film_id JOIN rental r ON r.inventory_id = i.inventory_id JOIN payment p ON p.rental_id = r.rental_id GROUP BY f.film_id, f.title ORDER BY revenue DESC LIMIT 5;And top customers by spend:
SELECT c.first_name, c.last_name, ROUND(SUM(p.amount), 2) AS total_spent, COUNT(*) AS payments FROM customer c JOIN payment p ON p.customer_id = c.customer_id GROUP BY c.customer_id, c.first_name, c.last_name ORDER BY total_spent DESC LIMIT 5;
Paste either into the SQL Console — they already returned real rows above.
What this shows
- You ask in plain language. The AI walks connection → database → tables itself — no schema lookup, no recalling table names.
- The number is real. It runs the query under MCP's read-only guard before answering, against your actual data.
- You keep the query. Handed back ready to paste and reuse — the AI never touches your write path.
What's next
- See another walkthrough: Cross-source validation with federated queries
- Configure your own AI client: MCP setup