Mastering Write SQL query
on Mistral Large 2
Stop guessing. See how professional prompt engineering transforms Mistral Large 2's output for specific technical tasks.
The "Vibe" Prompt
Optimized Version
Engineering Rationale
The optimized prompt provides a clear persona, detailed instructions, explicit table and column names, and a chain-of-thought breakdown. This specificity reduces ambiguity, guides the model through the logical steps, and helps it generate a more accurate and robust SQL query. The 'Thought Process' section acts as a strong few-shot example or a clear internal monologue for the model, improving output quality without necessarily increasing prompt length significantly for complex queries.
How We Validate This Prompt
Every optimized prompt for Write SQL query on Mistral Large 2 is scored against a fixed set of evaluation assertions. A revision ships only when it passes all of them, so the 0% token reduction never comes at the cost of output quality.
- The generated SQL uses `JOIN` correctly.
- The generated SQL filters by `EXTRACT(YEAR FROM order_date) = 2023` (or equivalent).
- The generated SQL uses `GROUP BY customer_id`.
- The generated SQL uses `SUM(total_amount)`.
- The generated SQL uses `ORDER BY SUM(total_amount) DESC`.
- The generated SQL uses `LIMIT 10`.
- The generated SQL selects `customer_id` and the summed amount.
Related Optimizations
Optimize your own Write SQL query prompt
Run any prompt through the same optimizer that produced this Mistral Large 2 guide — clarity, structure, and token efficiency in one pass.
Open the Optimizer